【发布时间】:2014-03-07 02:26:43
【问题描述】:
这似乎是一个基本的问题,但我在 SO 上的任何地方都找不到答案。
我知道 C/C++ 没有 byte 数据类型。
我知道sizeof(char) == 1。
我正在尝试在 Pebble 上存储 12 次传输,每个 96 字节,就像从我的 Android 应用程序传输的一样。
由于传输大小的限制,我一次发送一个。每个都应该“附加”到最后一个,因为它们最终应该在内存中形成顺序空间,以作为图像读取(每个像素一位)。
我正在尝试做这样的事情:
int transNum = 0;
uint8_t image[][] = new uint8t[12][12] //not sure about uint8_t, and I've forgotten how to do 'new' in C, I have to create just a pointer, and then malloc?
receivedHandler(DictionaryIterator *iter, void *context){
Tuple *receivedImage = dict_find(iter, KEY_IMG);
for (int i = 0; i < 12; i++) {
image[transNum][i] = receivedImage->value[i]->uint8_t;
}
transNum += 1; //this is in an implicit loop, since once done Pebble ACKs the transmission, and receivedHandler is called again by the next transmission
}
我是不是离得很近?
【问题讨论】:
标签: c pebble-watch pebble-sdk