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

C++ dict_write_uint8函数代码示例

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

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



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

示例1: request_weather

void request_weather(WeatherData *weather_data)
{
  APP_LOG(APP_LOG_LEVEL_DEBUG, "Request weather, retry: %i", retry_count);

  if (retry_count > MAX_RETRY) {
    APP_LOG(APP_LOG_LEVEL_DEBUG, "Too many retries");
    retry_count = 0;
    return;
  }

  if (!bluetooth_connection_service_peek()) {
    weather_data->error = WEATHER_E_DISCONNECTED;
    return;
  }

  DictionaryIterator *iter;
  app_message_outbox_begin(&iter);
  
  if (iter == NULL) {
    APP_LOG(APP_LOG_LEVEL_DEBUG, "Null iter");
    return;
  }

  dict_write_cstring(iter, KEY_SERVICE, weather_data->service);
  dict_write_cstring(iter, KEY_SCALE, weather_data->scale);
  dict_write_uint8(iter, KEY_DEBUG, (uint8_t)weather_data->debug);
  dict_write_uint8(iter, KEY_BATTERY, (uint8_t)weather_data->battery);

  dict_write_end(iter);

  app_message_outbox_send();
}
开发者ID:Zeduaz,项目名称:Weather-My-Way-INVERTED,代码行数:32,代码来源:network.c


示例2: main

int main() {
	app_message_register_outbox_sent(data_delivered);
	app_message_register_inbox_received(received_data);

	app_message_open(124, 50);

	DictionaryIterator *iterator;
	app_message_outbox_begin(&iterator);
	dict_write_uint8(iterator, 0, 0);
	dict_write_uint8(iterator, 1, 0);
	dict_write_uint16(iterator, 2, PROTOCOL_VERSION);
	#ifdef PBL_PLATFORM_APLITE
		dict_write_uint8(iterator, 3, 0);
	#else
		dict_write_uint8(iterator, 3, 1);
	#endif

	app_comm_set_sniff_interval(SNIFF_INTERVAL_REDUCED);
	app_message_outbox_send();

	switchWindow(0);
	app_event_loop();
	window_stack_pop_all(false);
	return 0;
}
开发者ID:faelys,项目名称:PebbleDialer-Watchapp,代码行数:25,代码来源:PebbleDialer.c


示例3: update_time

static void update_time() {
  // Get a tm structure
  time_t temp = time(NULL); 
  struct tm *tick_time = localtime(&temp);

  // Create a long-lived buffer
  static char buffer[] = "00:00";

  // Write the current hours and minutes into the buffer
  if(clock_is_24h_style() == true) {
    // Use 24 hour format
    strftime(buffer, sizeof("00:00"), "%H:%M", tick_time);
  } else {
    // Use 12 hour format
    strftime(buffer, sizeof("00:00"), "%I:%M", tick_time);
  }

  // Display this time on the TextLayer
  text_layer_set_text(s_time_layer, buffer);

  // Get weather update every 30 minutes
  if(tick_time->tm_min % 30 == 0) {
    // Begin dictionary
    DictionaryIterator *iter;
    app_message_outbox_begin(&iter);

    // Add a key-value pair
    dict_write_uint8(iter, 0, 0);
    dict_write_uint8(iter, 1, 1);

    // Send the message!
    app_message_outbox_send();
  }
}
开发者ID:remcovz,项目名称:PebbleTutorial1,代码行数:34,代码来源:main.c


示例4: push_button

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


示例5: change_volume

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


示例6: simply_msg_long_click

bool simply_msg_long_click(ButtonId button) {
  DictionaryIterator *iter = NULL;
  if (app_message_outbox_begin(&iter) != APP_MSG_OK) {
    return false;
  }
  dict_write_uint8(iter, 0, SimplyACmd_longClick);
  dict_write_uint8(iter, 1, button);
  return (app_message_outbox_send() == APP_MSG_OK);
}
开发者ID:ericmigi,项目名称:simplyjs-1,代码行数:9,代码来源:simply_msg.c


示例7: send_message

// Write message to buffer & send
void send_message(void){
	DictionaryIterator *iter;
	
	app_message_outbox_begin(&iter);
	dict_write_uint8(iter, STATUS_KEY, 0x1);
  dict_write_uint8(iter, GET_UPDATE_KEY, 0x2);
	
	dict_write_end(iter);
  	app_message_outbox_send();
}
开发者ID:smalley,项目名称:PebbleWorldCup,代码行数:11,代码来源:base.c


示例8: simply_msg_accel_tap

bool simply_msg_accel_tap(AccelAxisType axis, int32_t direction) {
  DictionaryIterator *iter = NULL;
  if (app_message_outbox_begin(&iter) != APP_MSG_OK) {
    return false;
  }
  dict_write_uint8(iter, 0, SimplyACmd_accelTap);
  dict_write_uint8(iter, 1, axis);
  dict_write_int8(iter, 2, direction);
  return (app_message_outbox_send() == APP_MSG_OK);
}
开发者ID:ericmigi,项目名称:simplyjs-1,代码行数:10,代码来源:simply_msg.c


示例9: send_initial_packet

static void send_initial_packet() {
	DictionaryIterator *iterator;
	app_message_outbox_begin(&iterator);
	dict_write_uint8(iterator, 0, 0);
	dict_write_uint8(iterator, 1, 0);
	dict_write_uint16(iterator, 2, PROTOCOL_VERSION);
	dict_write_uint32(iterator, 3, getCapabilities(appmessage_max_size));

	app_comm_set_sniff_interval(SNIFF_INTERVAL_REDUCED);
	app_message_outbox_send();
}
开发者ID:matejdro,项目名称:PebbleNotificationCenter-Watchapp,代码行数:11,代码来源:NotificationCenter.c


示例10: requestNumbers

static void requestNumbers(uint16_t pos)
{
	DictionaryIterator *iterator;
	app_message_outbox_begin(&iterator);
	dict_write_uint8(iterator, 0, 2);
	dict_write_uint8(iterator, 1, 0);
	dict_write_uint16(iterator, 2, pos);

	app_comm_set_sniff_interval(SNIFF_INTERVAL_REDUCED);
	app_message_outbox_send();
}
开发者ID:faelys,项目名称:PebbleDialer-Watchapp,代码行数:11,代码来源:CallLogWindow.c


示例11: send_message

// Write message to buffer & send
void send_message(int d)
{
	DictionaryIterator *iter;
	
	app_message_outbox_begin(&iter);
	dict_write_uint8(iter, STATUS_KEY, 0x1);
     dict_write_uint8(iter, MESSAGE_KEY, d);

     dict_write_end(iter);
     app_message_outbox_send();
}
开发者ID:loganisitt,项目名称:Pebblesss-watchapp,代码行数:12,代码来源:main.c


示例12: closeApp

void closeApp(void)
{
	DictionaryIterator *iterator;
	app_message_outbox_begin(&iterator);
	dict_write_uint8(iterator, 0, 0);
	dict_write_uint8(iterator, 1, 2);
	app_comm_set_sniff_interval(SNIFF_INTERVAL_REDUCED);
	app_message_outbox_send();

	closingMode = true;
}
开发者ID:faelys,项目名称:PebbleDialer-Watchapp,代码行数:11,代码来源:PebbleDialer.c


示例13: sendAction

void sendAction(int buttonId)
{
    DictionaryIterator *iterator;
    app_message_outbox_begin(&iterator);

    dict_write_uint8(iterator, 0, 7);
    dict_write_uint8(iterator, 1, buttonId);

    app_message_outbox_send();

    busy = true;
    vibes_cancel();
}
开发者ID:vitaliyy,项目名称:PebbleDialer-Watchapp,代码行数:13,代码来源:callscreen.c


示例14: menu_picked

void menu_picked(int index, void* context)
{
	show_loading();

	DictionaryIterator *iterator;
	app_message_outbox_begin(&iterator);

	dict_write_uint8(iterator, 0, 6);
	dict_write_uint8(iterator, 1, index);

	app_message_outbox_send();

	app_comm_set_sniff_interval(SNIFF_INTERVAL_REDUCED);
	app_comm_set_sniff_interval(SNIFF_INTERVAL_NORMAL);
}
开发者ID:40ft,项目名称:PebbleNotificationCenter-Watchapp,代码行数:15,代码来源:MainMenu.c


示例15: 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


示例16: 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


示例17: tick_handler

// TIME-RECURSIVE FUNCTIONS
static void tick_handler(struct tm *tick_time, TimeUnits units_changed) {
  // UPDATED THE TIME AND DATE
  update_time();
  
  // CALCULATES PEBBLE UPTIME
  // Use a long-lived buffer
  static char s_uptime_buffer[32];

  // Get time since launch
  int seconds = s_uptime % 60;
  int minutes = (s_uptime % 3600) / 60;
  int hours = s_uptime / 3600;

  // Update the TextLayer
  snprintf(s_uptime_buffer, sizeof(s_uptime_buffer), "LOG UPTIME: %dh %dm %ds", hours, minutes, seconds);
  text_layer_set_text(s_uptime_layer, s_uptime_buffer);
  
  // Increment s_uptime
  s_uptime++;
  
  // Get weather updates every 30 minutes
  if(tick_time->tm_min % 30 == 0) {
    // Begin dictionary
    DictionaryIterator *iter;
    app_message_outbox_begin(&iter);

    // Add a key-value pair
    dict_write_uint8(iter, 0, 0);

    // Send the message!
    app_message_outbox_send();
  }
}
开发者ID:marcellobrivio,项目名称:Pebble-Verbose-Watchface,代码行数:34,代码来源:main.c


示例18: category_menu_select_callback

static void category_menu_select_callback(MenuLayer *menu_layer, MenuIndex *cell_index, void *callback_context) {
  switch (cell_index->row) {
    case 0:
      // Info Sessions
      info_sessions_window_push();

      // Send AppMessage to get info sessions
      DictionaryIterator *iter;
      app_message_outbox_begin(&iter);
      dict_write_uint8(iter, KEY_GET_DATA, INFO_SESSION);
      dict_write_end(iter);
      app_message_outbox_send();

      break;
    case 1:
      // Lunch Menus
      display_food_menus_action_menu(LUNCH_MENU);

      break;
    case 2:
      // Dinner Menus
      display_food_menus_action_menu(DINNER_MENU);

      break;
  }
}
开发者ID:dsryang,项目名称:uwaterloo-for-pebble,代码行数:26,代码来源:main.c


示例19: 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


示例20: main_init

// omain init - registers callback functions, reads persistent data, and requests most recent data from
// companion app. Sets default timer length to 10 seconds.
void main_init(void) {
  s_reset_app(NULL);
    
  // initialize app message
  app_message_register_inbox_received(inbox_received_callback);
  app_message_register_inbox_dropped(inbox_dropped_callback);
  app_message_register_outbox_failed(outbox_failed_callback);
  app_message_register_outbox_sent(outbox_sent_callback);
  app_message_open(app_message_inbox_size_maximum(), app_message_outbox_size_maximum());
   
  // send request for most recent data
  DictionaryIterator *iter;
  app_message_outbox_begin(&iter);
  dict_write_uint8(iter, 0, 42);
  app_message_outbox_send();
  
  // gather persistent data for timer length and passcode
  if (persist_exists(TIMERLEN_PERSIST_KEY)) {
    s_timer_len = persist_read_int(TIMERLEN_PERSIST_KEY);
  } else {
    s_timer_len = 10*1000;
  }
  if (persist_exists(PASSCODE_PERSIST_KEY)) {
    s_passcode_defined = true;
    persist_read_string(PASSCODE_PERSIST_KEY, s_passcode, PASSCODE_LEN + 1);
  } else {
    s_passcode_defined = false;
  }
}
开发者ID:Tsukinara,项目名称:DangerZone,代码行数:31,代码来源:quick_alert.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ dictionary函数代码示例发布时间:2022-05-30
下一篇:
C++ dict_write_tuplet函数代码示例发布时间: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