Pebble 应用消息发送超时
Pebble App Message send timed out
我正在尝试 运行 来自 here 的卵石面示例项目(它从 URL 下载图像并将其发送到表盘)。我在 CloudPebble 和本地 C SDK 模拟器上尝试了 运行ning 项目。我得到相同的结果。我认为将应用程序消息发送到 javascript 有问题。这是来自 cloudpebble 的日志:
[DEBUG] netdownload.c:23: NetDownloadContext = 0x20020d68
[DEBUG] netdownload.c:30: Max buffer sizes are 2026 / 654
[DEBUG] pebble-faces.c:127: Done initializing, pushed window: 0x20020d7c
[DEBUG] netdownload.c:48: App message outbox sending..
[DEBUG] netdownload.c:51: App message outbox sent.
[PHONE] pebble-app.js:?: NetDownload JS Ready
[DEBUG] netdownload.c:151: Failed to send message. Reason = APP_MSG_SEND_TIMEOUT
我尝试进行更多调试。这是有问题的功能:
void netdownload_request(char *url) {
DictionaryIterator *outbox;
app_message_outbox_begin(&outbox);
// Tell the javascript how big we want each chunk of data: max possible size - dictionary overhead with one Tuple in it.
uint32_t chunk_size = app_message_inbox_size_maximum() - dict_calc_buffer_size(1);
dict_write_int(outbox, NETDL_CHUNK_SIZE, &chunk_size, sizeof(uint32_t), false);
// Send the URL
dict_write_cstring(outbox, NETDL_URL, url);
APP_LOG(APP_LOG_LEVEL_DEBUG, "App message outbox sending..");
app_message_open(app_message_inbox_size_maximum(), app_message_outbox_size_maximum());
app_message_outbox_send();
APP_LOG(APP_LOG_LEVEL_DEBUG, "App message outbox sent.");
}
注意:我添加了 APP_LOG 用于调试,以及 app_message_open(文档说这样做是为了获得最佳实践)。 app_message_open 没有效果,问题仍然存在。
出现这个问题是因为我在使用模拟器吗?我没有更改此项目代码中的任何其他内容..
您的问题是 JS 的启动时间比应用程序的启动时间长。消息在准备好接收之前被发送到 JS 模拟器。如果您 "shake" 手表(发送点击事件),它会再次尝试传输图像。
To interact with the emulator, click on the buttons on the sides, or click in the screen and then use the arrow keys for the buttons. In keyboard mode you can also press X, Y, or Z for a tap in the positive direction, or shift-X, shift-Y, or shift-Z for a tap in the negative direction.
(Source)
我正在尝试 运行 来自 here 的卵石面示例项目(它从 URL 下载图像并将其发送到表盘)。我在 CloudPebble 和本地 C SDK 模拟器上尝试了 运行ning 项目。我得到相同的结果。我认为将应用程序消息发送到 javascript 有问题。这是来自 cloudpebble 的日志:
[DEBUG] netdownload.c:23: NetDownloadContext = 0x20020d68
[DEBUG] netdownload.c:30: Max buffer sizes are 2026 / 654
[DEBUG] pebble-faces.c:127: Done initializing, pushed window: 0x20020d7c
[DEBUG] netdownload.c:48: App message outbox sending..
[DEBUG] netdownload.c:51: App message outbox sent.
[PHONE] pebble-app.js:?: NetDownload JS Ready
[DEBUG] netdownload.c:151: Failed to send message. Reason = APP_MSG_SEND_TIMEOUT
我尝试进行更多调试。这是有问题的功能:
void netdownload_request(char *url) {
DictionaryIterator *outbox;
app_message_outbox_begin(&outbox);
// Tell the javascript how big we want each chunk of data: max possible size - dictionary overhead with one Tuple in it.
uint32_t chunk_size = app_message_inbox_size_maximum() - dict_calc_buffer_size(1);
dict_write_int(outbox, NETDL_CHUNK_SIZE, &chunk_size, sizeof(uint32_t), false);
// Send the URL
dict_write_cstring(outbox, NETDL_URL, url);
APP_LOG(APP_LOG_LEVEL_DEBUG, "App message outbox sending..");
app_message_open(app_message_inbox_size_maximum(), app_message_outbox_size_maximum());
app_message_outbox_send();
APP_LOG(APP_LOG_LEVEL_DEBUG, "App message outbox sent.");
}
注意:我添加了 APP_LOG 用于调试,以及 app_message_open(文档说这样做是为了获得最佳实践)。 app_message_open 没有效果,问题仍然存在。
出现这个问题是因为我在使用模拟器吗?我没有更改此项目代码中的任何其他内容..
您的问题是 JS 的启动时间比应用程序的启动时间长。消息在准备好接收之前被发送到 JS 模拟器。如果您 "shake" 手表(发送点击事件),它会再次尝试传输图像。
To interact with the emulator, click on the buttons on the sides, or click in the screen and then use the arrow keys for the buttons. In keyboard mode you can also press X, Y, or Z for a tap in the positive direction, or shift-X, shift-Y, or shift-Z for a tap in the negative direction.
(Source)