• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ dict_write_end函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: play_pause

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


示例17: send_requestx

void send_requestx(int slot, int command)
{
	AppMessageResult result;
	DictionaryIterator *dict;
	result = app_message_outbox_begin(&dict);

	if (result == APP_MSG_OK)
	{
		dict_write_uint8(dict, slot, command);
		dict_write_end(dict);
		result = app_message_outbox_send();

		if (result == APP_MSG_OK)
		{
			app_comm_set_sniff_interval(SNIFF_INTERVAL_REDUCED);
		}
	}
	else
	{
		current_slot = slot;
		current_command = command;
		if (command_timer == NULL)
		{
			command_timer = app_timer_register(250, handle_resend, NULL);
		}
	}
}
开发者ID:JohnHoder,项目名称:CheatOnMe,代码行数:27,代码来源:CheatOnMe.c


示例18: shut_off

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


示例19: in_received_handler

static void in_received_handler(DictionaryIterator *iter, void *context) {
  Tuple *tuple;

  // send the launch_arg when we receive ready from JS
  tuple = dict_find(iter, APP_KEY_READY);
  if (tuple) {
    DictionaryIterator *iter;
    app_message_outbox_begin(&iter);
    dict_write_uint32(iter, APP_KEY_ACTION, launch_get_args());
    dict_write_end(iter);
    app_message_outbox_send();
  }

  // update text
  tuple = dict_find(iter, APP_KEY_TEXT);
  if (tuple) {
    snprintf(text, sizeof(text), "%s", tuple->value->cstring);
    text_layer_set_text(text_layer, text);
  }

  // quit the app
  tuple = dict_find(iter, APP_KEY_QUIT);
  if (tuple) {
    window_stack_pop_all(false);
  }
}
开发者ID:karthikv81,项目名称:timeline-tv-tracker,代码行数:26,代码来源:main.c


示例20: messsages_open_send

void messsages_open_send() {
  // first register callbacks
  app_message_register_inbox_received(messages_inbox_received);
  app_message_register_inbox_dropped(messages_inbox_dropped);
  app_message_register_outbox_sent(messages_outbox_sent);
  app_message_register_outbox_failed(messages_outbox_failed);
  
  if (app_message_open(APP_MESSAGE_INBOX_SIZE_MINIMUM, APP_MESSAGE_OUTBOX_SIZE_MINIMUM) != APP_MSG_OK) {
    APP_LOG(APP_LOG_LEVEL_ERROR, "Open Message Failed");
    return;
  }
  DictionaryIterator* dic_iterator;
  if (app_message_outbox_begin(&dic_iterator) != APP_MSG_OK) {
    APP_LOG(APP_LOG_LEVEL_ERROR, "Begin Message Outbox Failed");
    return;
  }
  char buffer[50];
  time_t now;
  time(&now);
  strftime(buffer, sizeof(buffer),"P: %H:%M %S", localtime(&now));
  // write some data
  dict_write_cstring(dic_iterator, 1, buffer);
  dict_write_end(dic_iterator);
  // send
  app_message_outbox_send();
  APP_LOG(APP_LOG_LEVEL_INFO,"Message %s sent",buffer);
}
开发者ID:bingtimren,项目名称:Testbed42,代码行数:27,代码来源:messages.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ dict_write_tuplet函数代码示例发布时间:2022-05-30
下一篇:
C++ dict_read_next函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap