当前位置: 首页>>代码示例>>C++>>正文


C++ dict_write_end函数代码示例

本文整理汇总了C++中dict_write_end函数的典型用法代码示例。如果您正苦于以下问题:C++ dict_write_end函数的具体用法?C++ dict_write_end怎么用?C++ dict_write_end使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了dict_write_end函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: fetch_data

static void fetch_data(void) {

  Tuplet style_tuple = TupletInteger(STYLE_KEY, 0);
  Tuplet bluetoothvibe_tuple = TupletInteger(BLUETOOTHVIBE_KEY, 0);
  Tuplet hourlyvibe_tuple = TupletInteger(HOURLYVIBE_KEY, 0);
  Tuplet blink_tuple = TupletInteger(BLINK_KEY, 0);
  Tuplet dateformat_tuple = TupletInteger(DATEFORMAT_KEY, 0);
  Tuplet units_tuple = TupletInteger(WEATHER_UNITS, 0);
  Tuplet weather_temperature_tuple = TupletInteger(WEATHER_TEMPERATURE_KEY, 0);
  Tuplet weather_icon_tuple = TupletInteger(WEATHER_ICON_KEY, 0);
  Tuplet weather_high_tuple = TupletInteger(WEATHER_TEMPERATUREHIGH_KEY, 0);
  Tuplet weather_low_tuple = TupletInteger(WEATHER_TEMPERATURELOW_KEY, 0);

  DictionaryIterator *iter;
  app_message_outbox_begin(&iter);

  if (iter == NULL) {
    return;
  }

  dict_write_tuplet(iter, &style_tuple);
  dict_write_tuplet(iter, &bluetoothvibe_tuple);
  dict_write_tuplet(iter, &hourlyvibe_tuple);
  dict_write_tuplet(iter, &units_tuple);
  dict_write_tuplet(iter, &weather_temperature_tuple);
  dict_write_tuplet(iter, &weather_icon_tuple);
  dict_write_tuplet(iter, &weather_high_tuple);
  dict_write_tuplet(iter, &weather_low_tuple);
  dict_write_tuplet(iter, &blink_tuple);
  dict_write_tuplet(iter, &dateformat_tuple);
  dict_write_end(iter);

  app_message_outbox_send();
}
开发者ID:vekexasia,项目名称:Chunk-Weather-v2.0,代码行数:34,代码来源:chunk.c

示例2: send_message

void send_message(int status) {
	DictionaryIterator *iter;
  app_message_outbox_begin(&iter);
  dict_write_int8(iter, STATUS_KEY, status);
	dict_write_end(iter);
  app_message_outbox_send();
}
开发者ID:TurplePurtle,项目名称:PCRemote,代码行数:7,代码来源:send_message.c

示例3: send_message

static void send_message() {   
  APP_LOG(APP_LOG_LEVEL_DEBUG, "Got to sending message.");
  if (hint_layer) {
    text_layer_destroy(hint_layer);
    hint_layer = NULL;
  } else {
    DictionaryIterator *iter;
    app_message_outbox_begin(&iter);
    if (iter == NULL) {
      vibes_short_pulse();
      APP_LOG(APP_LOG_LEVEL_WARNING, "Can not send request to phone!");
      return;
    }
    dict_write_uint8(iter, MSG_KEY, message);
    dict_write_cstring(iter, TEXT1_KEY, s_last_text[0]);
    dict_write_cstring(iter, TEXT2_KEY, s_last_text[1]);
    dict_write_cstring(iter, TEXT3_KEY, s_last_text[2]);
    const uint32_t final_size = dict_write_end(iter);
    app_message_outbox_send();
    APP_LOG(APP_LOG_LEVEL_DEBUG, "Sent message '%d' to phone! (%d bytes)", message, (int) final_size);
    if (!hint_layer) {
      Layer *window_layer = window_get_root_layer(window);
      hint_layer = text_layer_create(hint_layer_size);
      text_layer_set_font(hint_layer, fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD));
      text_layer_set_text_alignment(hint_layer, GTextAlignmentCenter);
      layer_add_child(window_layer, text_layer_get_layer(hint_layer));
    }
    snprintf(hint_text, sizeof(hint_text), "Sent\nmessage\n'%s'",label[message-1]);
    text_layer_set_text(hint_layer, hint_text);   
  }
}
开发者ID:clach04,项目名称:send_message,代码行数:31,代码来源:SendMessage.c

示例4: pin_set_handler

static void pin_set_handler(ClickRecognizerRef recognizer, void *context) {
  APP_LOG(APP_LOG_LEVEL_DEBUG, "Pin set");
  if (hint_layer) {
    text_layer_destroy(hint_layer);
    hint_layer = NULL;
  } 
  else {
    app_timer_reschedule(locationtimer, 1000 * (nextcall + 10));
    strcpy(command, "pin");
    DictionaryIterator *iter;
    app_message_outbox_begin(&iter);
    if (iter == NULL) {
      vibes_short_pulse();
      APP_LOG(APP_LOG_LEVEL_WARNING, "Can not send command %s to phone!", command);
      return;
    }
    dict_write_cstring(iter, CMD_KEY, command);
    const uint32_t final_size = dict_write_end(iter);
    app_message_outbox_send();
    APP_LOG(APP_LOG_LEVEL_DEBUG, "Sent command '%s' to phone! (%d bytes)", command, (int) final_size);
    if (!hint_layer) {
      Layer *window_layer = window_get_root_layer(window);
      hint_layer = text_layer_create(hint_layer_size);
      text_layer_set_font(hint_layer, fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD));
      text_layer_set_text_alignment(hint_layer, GTextAlignmentCenter);
      layer_add_child(window_layer, text_layer_get_layer(hint_layer));
    }
    text_layer_set_text(hint_layer, "\nSetting\ntimeline\npin...");
  }
}
开发者ID:edmund-k,项目名称:pebble-geocachingpro-back,代码行数:30,代码来源:GetBack.c

示例5: select_click_callback

static void select_click_callback(MenuLayer *menu_layer, MenuIndex *cell_index, void *callback_context) {
  APP_LOG(APP_LOG_LEVEL_DEBUG, "Got a click for row %d", cell_index->row);
  if (hint_layer) {
    text_layer_destroy(hint_layer);
    hint_layer = NULL;
  }
  if (cell_index->row > 0) {
    app_timer_reschedule(locationtimer, 1000 * (nextcall + 10));
    if (cell_index->row == 1) {
      strcpy(command, "set");
    text_layer_set_text(distance_layer, "0");
    } else
      snprintf(command, sizeof(command), "set%d", (cell_index->row)-2);
    DictionaryIterator *iter;
    app_message_outbox_begin(&iter);
    if (iter == NULL) {
      vibes_short_pulse();
      APP_LOG(APP_LOG_LEVEL_WARNING, "Can not send command %s to phone!", command);
      return;
    }
    dict_write_cstring(iter, CMD_KEY, command);
    const uint32_t final_size = dict_write_end(iter);
    app_message_outbox_send();
    APP_LOG(APP_LOG_LEVEL_DEBUG, "Sent command '%s' to phone! (%d bytes)", command, (int) final_size);
  }
  window_stack_pop(animated);
}
开发者ID:edmund-k,项目名称:pebble-geocachingpro-back,代码行数:27,代码来源:GetBack.c

示例6: send_to_phone

static void send_to_phone() {
  APP_LOG(APP_LOG_LEVEL_DEBUG, "Preparing data to send to Phone");

  if (listSize == 0) return;
  DictionaryIterator *dict;
  app_message_outbox_begin(&dict);

  int indexToSend = (int) menu_layer_get_selected_index(s_menu_layer).row;
  APP_LOG(APP_LOG_LEVEL_DEBUG, "statusList[indexToSend] set to: %s", statusList[indexToSend]);
  
  if (strcmp(statusList[indexToSend],"Ready") != 0 &&
     strcmp(statusList[indexToSend],"Pending...") != 0) {
    free (statusList[indexToSend]);
    statusList[indexToSend] = NULL;
   APP_LOG(APP_LOG_LEVEL_DEBUG, "?Preparing data to send to Phone");
  }
  menu_layer_reload_data(s_menu_layer);
  statusList[indexToSend] = "Pending...";
  APP_LOG(APP_LOG_LEVEL_DEBUG, "statusList[%d] set to Waiting...", indexToSend);

  APP_LOG(APP_LOG_LEVEL_DEBUG, "Menu index to send: %d", indexToSend);
  dict_write_uint8(dict,KEY_INDEX,indexToSend);
  const uint32_t final_size = dict_write_end(dict);
  APP_LOG(APP_LOG_LEVEL_DEBUG, "Sent message to phone! (%d bytes)", (int) final_size);
  app_message_outbox_send();
}
开发者ID:clach04,项目名称:HTTP-Push,代码行数:26,代码来源:HTTP.c

示例7: send_settings_to_phone

static void send_settings_to_phone() {
  if (!JS_ready) return;
  DictionaryIterator *iter;
  app_message_outbox_begin(&iter);
  int dummy_int;
  
  dict_write_cstring(iter, KEY_APP_VERSION, app_version);
  dummy_int=CURRENT_STORAGE_VERSION; dict_write_int(iter, KEY_VERSION, &dummy_int, sizeof(int), true);
  dummy_int=data_timestamp;          dict_write_int(iter, KEY_TIMESTAMP, &dummy_int, sizeof(int), true);
  dummy_int=settings.Show_clock;     dict_write_int(iter, KEY_SHOW_CLOCK, &dummy_int, sizeof(int), true);
  dummy_int=settings.Auto_sort;      dict_write_int(iter, KEY_AUTO_SORT, &dummy_int, sizeof(int), true);
  dummy_int=settings.Hrs_day_x10;    dict_write_int(iter, KEY_HRS_PER_DAY, &dummy_int, sizeof(int), true);
  dummy_int=settings.Last_reset;     dict_write_int(iter, KEY_LAST_RESET, &dummy_int, sizeof(int), true);
  
  if (timer.Active) dict_write_data(iter, KEY_TIMER, (void*) &timer, sizeof(timer));
  jobs_list_write_dict(iter, KEY_JOBS);

  if (export_after_save) {
    dummy_int=true;
    dict_write_int(iter, KEY_EXPORT, &dummy_int, sizeof(int), true);
    export_after_save=false;
  }
  
  dict_write_end(iter);
  LOG("sending outbox...");
  app_message_outbox_send();
}
开发者ID:wildhart,项目名称:Job-Timer,代码行数:27,代码来源:main.c

示例8: timer_callback

static void timer_callback(void *data) {
	DictionaryIterator *iter;
	app_message_outbox_begin(&iter);
	dict_write_uint8(iter, KEY_METHOD, KEY_METHOD_READY);
	dict_write_end(iter);
	app_message_outbox_send();
}
开发者ID:Neal,项目名称:OpalX,代码行数:7,代码来源:light.c

示例9: http_capture_send_buffer

static void http_capture_send_buffer() {
	int len = 64;
	if (http_capture_sentLen+len > 18*168)
		len = 18*168 - http_capture_sentLen;
	if (len <= 0)
		return;
		
	Tuplet start = TupletInteger(0xFFF9, http_capture_sentLen);
	Tuplet buf = TupletBytes(1000, &http_capture_frameBuffer[http_capture_sentLen], len);

	DictionaryIterator *iter;
	app_message_out_get(&iter);

	if (iter == NULL)
		return;

	dict_write_tuplet(iter, &start);
	dict_write_tuplet(iter, &buf);
	dict_write_end(iter);

	http_capture_sentLen += len;

	app_message_out_send();
	app_message_out_release();	
}
开发者ID:MarkusLitz,项目名称:meditation,代码行数:25,代码来源:httpcapture.c

示例10: sendScore

void sendScore(uint16_t score)
{
  // Begin dictionary
  DictionaryIterator *iter;
  app_message_outbox_begin(&iter);
  
  // Add a key-value pair
  DictionaryResult result = dict_write_uint16(iter, 1, score);
  switch(result)
  {
    case DICT_OK:
      APP_LOG(APP_LOG_LEVEL_INFO, "nothing went wrong in message construction");
      break;
    case DICT_INVALID_ARGS:
    case DICT_MALLOC_FAILED:
    case DICT_INTERNAL_INCONSISTENCY:
    case DICT_NOT_ENOUGH_STORAGE:
    default:
      APP_LOG(APP_LOG_LEVEL_INFO, "something went wrong in message construction");
      break;
  }
  uint32_t size = dict_write_end(iter);
  APP_LOG(APP_LOG_LEVEL_INFO, "size of dictionary: %u", (unsigned int)size);
  
  // Send the message!
  app_message_outbox_send();
  
}
开发者ID:b0ggyb33,项目名称:mrgameandwatch,代码行数:28,代码来源:JavascriptInterface.c

示例11: read_presets

void read_presets() {
    DictionaryIterator *iter;
    app_message_outbox_begin(&iter);
    dict_write_uint8(iter, KEY_CMD_EXECUTED,CMD_GET_PRESETS);
    dict_write_end(iter);
    app_message_outbox_send();
}
开发者ID:rbenamotz,项目名称:PebbleSoundTouch,代码行数:7,代码来源:comm.c

示例12: broadcast_inbox_size

/**
 * Sends inbox size to phone as a
 * little-endian byte array of length 4.
 */
void broadcast_inbox_size(uint32_t size) {
    DictionaryIterator *dict;
    app_message_outbox_begin(&dict);
    dict_write_data(dict, INBOX_SIZE_KEY, (uint8_t *)&size, 4);
    dict_write_end(dict);
    app_message_outbox_send();
}
开发者ID:penman,项目名称:pebble-browse,代码行数:11,代码来源:http.c

示例13: send_cmd

static void send_cmd(void) {

	DictionaryIterator *iter;
	app_message_outbox_begin(&iter);

	if (iter == NULL) {
		return;
	}
	static char *bgptr = last_bg;
		static char *bgptr2 = last_bg_2;
	static char *timeptr = new_time;
		static char *timeptr_2 = new_time_2;

	Tuplet alertval = TupletInteger(3, 0);
	Tuplet bgVal = TupletCString(1, bgptr);
	Tuplet bgVal2 = TupletCString(4, bgptr2);
	Tuplet lastTimeVal = TupletCString(2, timeptr);
	Tuplet lastTimeVal2 = TupletCString(6, timeptr_2);


	dict_write_tuplet(iter, &alertval);
	dict_write_tuplet(iter, &bgVal);
	dict_write_tuplet(iter, &bgVal2);
	dict_write_tuplet(iter, &lastTimeVal);
	dict_write_tuplet(iter, &lastTimeVal2);

	dict_write_end(iter);

	app_message_outbox_send();

}
开发者ID:CGMintheCloud,项目名称:cgm-pebble-splitscreen,代码行数:31,代码来源:cgm.c

示例14: down_click_handler

static void down_click_handler(ClickRecognizerRef recognizer, void *context) {
	int raceRoundInt = atoi(raceRoundChar);
//	APP_LOG(APP_LOG_LEVEL_DEBUG, "raceRoundChar = %s",  raceRoundChar); 
//	APP_LOG(APP_LOG_LEVEL_DEBUG, "currently round %d", raceRoundInt); 
//	APP_LOG(APP_LOG_LEVEL_DEBUG, "creating new round %d = current round+1", raceRoundInt + 1); 
	text_layer_set_text(round_layer, "getting race");
	raceRoundInt = raceRoundInt + 1; 
	if (raceRoundInt > 19) {
		raceRoundInt = 19; 
		APP_LOG(APP_LOG_LEVEL_DEBUG, "max round reached"); 
	}
		
	//int i;
	char roundRequestChar[] = "123456";
	snprintf(roundRequestChar, sizeof(roundRequestChar), "%d", raceRoundInt);
//	APP_LOG(APP_LOG_LEVEL_DEBUG, "race round string = %%s %s", roundRequestChar);   
	//text_layer_set_text(&countLayer, buf);
	
	//Tuplet request_tuple = TupletCString(REQUEST_KEY, roundRequestChar);
//	Tuplet request_tuple; 
	DictionaryIterator *iter;
	app_message_outbox_begin(&iter);
	
	if (iter == NULL) {
		return; 
	}
	dict_write_cstring(iter, REQUEST_KEY, roundRequestChar);
//	dict_write_tuplet(iter, &request_tuple); 
	dict_write_end(iter); 
	
	app_message_outbox_send(); 
	//send_message(); 
  	//fetch_msg();
}
开发者ID:skybolt,项目名称:pebble_f1_2014,代码行数:34,代码来源:schedule.c

示例15: next_track

void next_track() {
    DictionaryIterator *iter;
    app_message_outbox_begin(&iter);
    dict_write_uint8(iter, KEY_CMD_EXECUTED,CMD_NEXT_TRACK);
    dict_write_end(iter);
    app_message_outbox_send();
}
开发者ID:rbenamotz,项目名称:PebbleSoundTouch,代码行数:7,代码来源:comm.c


注:本文中的dict_write_end函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。