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


C++ TupletInteger函数代码示例

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


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

示例1: handle_init

void handle_init(AppContextRef ctx) {

  window_init(&window, "Simplicity");
  window_stack_push(&window, true /* Animated */);
  window_set_background_color(&window, GColorBlack);

  resource_init_current_app(&APP_RESOURCES);

  layer_init(&time_layer, GRect(0, 12, 144, 168-68));
  layer_add_child(&window.layer, &time_layer);

  text_layer_init(&text_date_layer, window.layer.frame);
  text_layer_set_text_color(&text_date_layer, GColorWhite);
  text_layer_set_background_color(&text_date_layer, GColorClear);
  layer_set_frame(&text_date_layer.layer, GRect(8, 0, 144-8, 168-68));
  text_layer_set_font(&text_date_layer, fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ROBOTO_CONDENSED_21)));
  layer_add_child(&time_layer, &text_date_layer.layer);


  text_layer_init(&text_time_layer, window.layer.frame);
  text_layer_set_text_color(&text_time_layer, GColorWhite);
  text_layer_set_background_color(&text_time_layer, GColorClear);
  layer_set_frame(&text_time_layer.layer, GRect(7, 24, 144-7, 168-92));
  text_layer_set_font(&text_time_layer, fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ROBOTO_BOLD_SUBSET_49)));
  layer_add_child(&time_layer, &text_time_layer.layer);


  layer_init(&line_layer, window.layer.frame);
  line_layer.update_proc = &line_layer_update_callback;
  layer_add_child(&time_layer, &line_layer);

  layer_init(&car_layer, GRect(0, 90, 144, 168-90));
  layer_add_child(&window.layer, &car_layer);

  text_layer_init(&text_rated_layer, window.layer.frame);
  text_layer_set_text_color(&text_rated_layer, GColorWhite);
  text_layer_set_background_color(&text_rated_layer, GColorClear);
  layer_set_frame(&text_rated_layer.layer, GRect(8, 0, 144-8, 168-68));
  text_layer_set_font(&text_rated_layer, fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ROBOTO_CONDENSED_21)));
  layer_add_child(&car_layer, &text_rated_layer.layer);
	
  text_layer_init(&text_state_layer, window.layer.frame);
  text_layer_set_text_color(&text_state_layer, GColorWhite);
  text_layer_set_background_color(&text_state_layer, GColorClear);
  layer_set_frame(&text_state_layer.layer, GRect(8, 20, 144-8, 168-68));
  text_layer_set_font(&text_state_layer, fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ROBOTO_CONDENSED_21)));
  layer_add_child(&car_layer, &text_state_layer.layer);
	
  layer_init(&battery_layer, GRect(72, 10, 144-70, 10));
  battery_layer.update_proc = &battery_layer_update_callback;
  layer_add_child(&car_layer, &battery_layer);

  Tuplet initial_values[] = {
    TupletInteger(TESLA_RATED_REMAIN_KEY, (uint16_t) 148),
    TupletCString(TESLA_STATE_STRING_KEY, "Charging"),
	TupletInteger(TESLA_BATTERY_PERCENT_KEY, (uint8_t) 72),
  };
  app_sync_init(&sync, sync_buffer, sizeof(sync_buffer), initial_values, ARRAY_LENGTH(initial_values),
                sync_tuple_changed_callback, sync_error_callback, NULL);
}
开发者ID:banahogg,项目名称:TeslaPebble-Pebble,代码行数:60,代码来源:main.c

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

示例3: go_next_or_prev

// Next or previous
void go_next_or_prev(uint8_t key, uint8_t cmd){
  if (current == -1 || max == -1){
    //Not all data has been received, unable to determine if you can go next/prev
    return;
  }
  if (current == 1 && cmd == BUTTON_PREVIOUS){
    //First already, cannot prev, exit
    return;
  }
  if (current == max && cmd == BUTTON_NEXT){
    //Last in list, exit
    return;
  }
  resetData();
  if (debugMode)
    APP_LOG(APP_LOG_LEVEL_INFO, "Sending data to phone");
  DictionaryIterator *iter;
  app_message_outbox_begin(&iter);
      
  Tuplet value = TupletInteger(key, cmd);
  dict_write_tuplet(iter, &value);
  
  if (current != -1){
    Tuplet page = TupletInteger(MESSAGE_CURRENT_FAV, current);
    dict_write_tuplet(iter, &page);
  }
  
  app_message_outbox_send();
}
开发者ID:itachi1706,项目名称:SingBuses,代码行数:30,代码来源:bus_layout.c

示例4: accel_data_callback

/*----------------------------------------------------------------------------*/
void accel_data_callback(void * data, uint32_t num_samples)
{
  AppMessageResult result;
  AccelData * vector = (AccelData*) data;

  if (vector->did_vibrate) {
    syncStats.sync_vib++;
    return;
  }

  if (syncChangeCount > 0) {
    syncStats.sync_missed++;
    return;
  }

  /* Build the dictionary to hold this vector */
  Tuplet vector_dict[] = {
    TupletInteger(PP_KEY_CMD, PP_CMD_VECTOR),
    TupletInteger(PP_KEY_X, (int) vector->x),
    TupletInteger(PP_KEY_Y, (int) vector->y),
    TupletInteger(PP_KEY_Z, (int) vector->z),
  };

  /* Send the newly built dictionary to the remote side. */
  result = app_sync_set( &sync, vector_dict, ARRAY_LENGTH(vector_dict) );

  if (result != APP_MSG_OK) {
      APP_LOG(APP_LOG_LEVEL_DEBUG, "app_sync_set: APP_MSG_%s",
             AppMessageResult_to_String(result));
  }
  else {
    syncChangeCount = ARRAY_LENGTH(vector_dict);
    syncStats.sync_set++;
  }
}
开发者ID:konsumer,项目名称:PebblePointer,代码行数:36,代码来源:PebblePointer.c

示例5: submit_time_to_task

void submit_time_to_task(ClickRecognizerRef recognizer, Window *window) {
	app_message_outbox_begin(&iter);
	Tuplet value = TupletCString(0, "postTask");
	dict_write_tuplet(iter, &value);
	Tuplet start = TupletInteger(1, start_time);
	dict_write_tuplet(iter, &start);
	Tuplet duration = TupletInteger(1, elapsed_time);
	dict_write_tuplet(iter, &duration);
	app_message_outbox_send();
}
开发者ID:BillMyTime,项目名称:bill-my-time-pebble,代码行数:10,代码来源:billmytime.c

示例6: config_init

static void config_init(void) {
    // no need for large inbox/outbox, just handling configuration messages
    app_message_open(100, 100);

    Tuplet initial_values[] = {
        TupletInteger(BACKGROUND_COLOR_KEY, pcb_background.argb),
        TupletInteger(SILKSCREEN_COLOR_KEY, pcb_silkscreen.argb)
    };
    app_sync_init(
        &s_sync, s_sync_buffer, sizeof(s_sync_buffer), 
        initial_values, ARRAY_LENGTH(initial_values), 
        sync_changed_handler, sync_error_handler, NULL);
}
开发者ID:llamahunter,项目名称:resistor-time,代码行数:13,代码来源:resistor.c

示例7: request_send_acc

void request_send_acc(void) {
	
	uint16_t ms;
	time_t now;
	time_ms(&now, &ms);
	char buffer[15];
	snprintf(buffer, sizeof(buffer) - 1, "%lu%03d", now, ms);
	
	// snprintf(xyz_str,22 ,"X,Y,Z: %d,%d,%d",acc_data[0],acc_data[1],acc_data[2] );
	//APP_LOG(APP_LOG_LEVEL_DEBUG, "%s",xyz_str);
	app_message_outbox_begin(&iter);

    long long nowz = now;
    nowz = nowz * 1000 + ms;

    

	Tuplet t = TupletStaticCString(KEY_OFFSET + T_TIME_BASE, buffer, strlen(buffer));
	dict_write_tuplet(iter, &t);
	Tuplet act = TupletStaticCString(KEY_OFFSET + T_ACTIVITY, cur_activity, strlen(cur_activity));
	dict_write_tuplet(iter, &act);
    
    for(int i = 0; i < NUM_SAMPLES; i++) {
    
        int point = KEY_OFFSET + (10 * i);
        
        Tuplet ts = TupletInteger(point + T_TS, (int)(nowz - accl_data[i].timestamp));
        dict_write_tuplet(iter, &ts);
        
        Tuplet x = TupletInteger(point + T_X, accl_data[i].x);
        dict_write_tuplet(iter, &x);

        Tuplet y = TupletInteger(point + T_Y, accl_data[i].y);
        dict_write_tuplet(iter, &y);

        Tuplet z = TupletInteger(point + T_Z, accl_data[i].z);
        dict_write_tuplet(iter, &z);

        Tuplet dv = TupletStaticCString(point + T_DID_VIBRATE, accl_data[i].did_vibrate?"1":"0", 1);
        dict_write_tuplet(iter, &dv);

	}
	
	app_message_outbox_send();
	waiting_data = false;
	msg_run = true;
	acc_count++;
}
开发者ID:LeadersOutFront,项目名称:PebbleRetreatSchedule,代码行数:48,代码来源:accl.c

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

示例9: window_load

static void window_load(Window *window) {
  Layer *window_layer = window_get_root_layer(window);
  
  temperature_layer = text_layer_create(GRect(0, 140, 155, 40));
  text_layer_set_text_color(temperature_layer, GColorWhite);
  text_layer_set_background_color(temperature_layer, GColorBlack);
  text_layer_set_font(temperature_layer, fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD));
  text_layer_set_text_alignment(temperature_layer, GTextAlignmentCenter);
  text_layer_set_text(temperature_layer, temperature);

  Tuplet initial_values[] = {
    TupletInteger(WEATHER_ICON_KEY, (uint8_t) 1),
    TupletCString(WEATHER_TEMPERATURE_KEY, "1234\u00B0C"),
  };
  app_sync_init(&sync, sync_buffer, sizeof(sync_buffer), initial_values, ARRAY_LENGTH(initial_values),
      sync_tuple_changed_callback, sync_error_callback, NULL);

  layer_add_child(window_layer, text_layer_get_layer(temperature_layer));
  
  s_time_layer = text_layer_create(GRect(0, 0, 150, 40));
  text_layer_set_background_color(s_time_layer, GColorBlack);
  text_layer_set_text_color(s_time_layer, GColorWhite);
  text_layer_set_text(s_time_layer, "00:00:00");
  
  text_layer_set_font(s_time_layer, fonts_get_system_font(FONT_KEY_GOTHIC_28));
  text_layer_set_text_alignment(s_time_layer, GTextAlignmentCenter);
  
  layer_add_child(window_get_root_layer(window), text_layer_get_layer(s_time_layer));
  
  changeWeatherCode(0);
  
  timer = app_timer_register(delta, (AppTimerCallback) timer_callback, NULL);
}
开发者ID:inb4ohnoes,项目名称:pebblebuddy,代码行数:33,代码来源:weather.c

示例10: init

static void init() {
  window = window_create();
  window_set_background_color(window, GColorBlack);
  window_set_fullscreen(window, true);

  icon_layer = bitmap_layer_create(GRect(32, 10, 80, 80));
  bitmap_layer_set_bitmap(icon_layer, icon_bitmap);
  layer_add_child(window_get_root_layer(window), bitmap_layer_get_layer(icon_layer));

  temperature_layer = text_layer_create(GRect(0, 100, 144, 68));
  text_layer_set_text_color(temperature_layer, GColorWhite);
  text_layer_set_background_color(temperature_layer, GColorClear);
  text_layer_set_font(temperature_layer, fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD));
  text_layer_set_text_alignment(temperature_layer, GTextAlignmentCenter);
  text_layer_set_text(temperature_layer, temperature);
  layer_add_child(window_get_root_layer(window), text_layer_get_layer(temperature_layer));

  Tuplet initial_values[] = {
    TupletInteger(WEATHER_ICON_KEY, (uint8_t) 1),
    TupletCString(WEATHER_TEMPERATURE_KEY, "1234\u00B0C"),
  };

  app_message_open(64, 64);
  send_cmd();

  app_sync_init(&sync, sync_buffer, sizeof(sync_buffer), initial_values, ARRAY_LENGTH(initial_values),
      sync_tuple_changed_callback, sync_error_callback, NULL);


  window_stack_push(window, true /* Animated */);
}
开发者ID:southwolf,项目名称:sdk2-test,代码行数:31,代码来源:weather.c

示例11: qtp_setup_app_message

/* Setup app message callbacks for weather */
void qtp_setup_app_message() {
#ifdef QTP_DEBUG
	APP_LOG(APP_LOG_LEVEL_DEBUG, "QTP: setting app message for weather");
#endif

	const int inbound_size = 100;
	const int outbound_size = 100;
	app_message_open(inbound_size, outbound_size);
	Tuplet initial_values[] = {
		TupletInteger(QTP_WEATHER_ICON_KEY, (uint8_t) 8),
		TupletCString(QTP_WEATHER_TEMP_F_KEY, "---\u00B0F"),
		TupletCString(QTP_WEATHER_TEMP_C_KEY, "---\u00B0F"),
		TupletCString(QTP_WEATHER_CITY_KEY, "Atlanta      "),
		TupletCString(QTP_WEATHER_DESC_KEY, "                       ")
	};
#ifdef QTP_DEBUG
	APP_LOG(APP_LOG_LEVEL_DEBUG, "QTP: weather tuples intialized");
#endif

	app_sync_init(&qtp_sync, qtp_sync_buffer, sizeof(qtp_sync_buffer), initial_values, ARRAY_LENGTH(initial_values),
	  qtp_sync_changed_callback, qtp_sync_error_callback, NULL);
#ifdef QTP_DEBUG
	APP_LOG(APP_LOG_LEVEL_DEBUG, "QTP: weather app message initialized");
#endif

}
开发者ID:adcurtin,项目名称:QuickTapPlus,代码行数:27,代码来源:QTPlus.c

示例12: select_menu_callback

 // Menu callback
 void select_menu_callback(int index, void *context) {
	app_message_outbox_begin(&iter);
	static char* select_action;
	if  (strcmp(menu_action, "c") == 0) {
		select_action = "selClient";
	} else if(strcmp(menu_action, "t") == 0) {
		select_action = "selTask";
		snprintf(task_title, 40, "Task:\n%s", list_menu_items[index].title);
		text_layer_set_text(task_layer, task_title);
	} else if (strcmp(menu_action, "p") == 0) {
		select_action = "selProj";
		snprintf(project_title, 40, "Project:\n%s", list_menu_items[index].title);
		text_layer_set_text(task_layer, project_title);
	} else {
		// strcmp failed to find a match
		APP_LOG(APP_LOG_LEVEL_DEBUG, "No match on strcmp, value of menu_action follows");
		APP_LOG(APP_LOG_LEVEL_DEBUG, menu_action);
	}
	Tuplet action_type = TupletCString(0, select_action);
	dict_write_tuplet(iter, &action_type);
	Tuplet selected = TupletInteger(1, index);
	dict_write_tuplet(iter, &selected);
	app_message_outbox_send(); // this send is causing crash :S

	//pop the menu off
	window_stack_pop(true);
 }
开发者ID:BillMyTime,项目名称:bill-my-time-pebble,代码行数:28,代码来源:billmytime.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: window_load

static void window_load(Window *window) {
  Layer *window_layer = window_get_root_layer(window);
  GRect bounds = layer_get_bounds(window_layer);

  s_icon_layer = bitmap_layer_create(GRect(32, 10, 80, 80));
  layer_add_child(window_layer, bitmap_layer_get_layer(s_icon_layer));

  s_temperature_layer = text_layer_create(GRect(0, 75, bounds.size.w, 68));
  text_layer_set_text_color(s_temperature_layer, GColorWhite);
  text_layer_set_background_color(s_temperature_layer, GColorClear);
  text_layer_set_font(s_temperature_layer, fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD));
  text_layer_set_text_alignment(s_temperature_layer, GTextAlignmentCenter);
  layer_add_child(window_layer, text_layer_get_layer(s_temperature_layer));

  s_city_layer = text_layer_create(GRect(0, 105, bounds.size.w, 68));
  text_layer_set_text_color(s_city_layer, GColorWhite);
  text_layer_set_background_color(s_city_layer, GColorClear);
  text_layer_set_font(s_city_layer, fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD));
  text_layer_set_text_alignment(s_city_layer, GTextAlignmentCenter);
  layer_add_child(window_layer, text_layer_get_layer(s_city_layer));

  Tuplet initial_values[] = {
    TupletInteger(WEATHER_ICON_KEY, (uint8_t) 1),
    TupletCString(WEATHER_TEMPERATURE_KEY, "1234\u00B0C"),
    TupletCString(WEATHER_CITY_KEY, "St Pebblesburg"),
  };

  app_sync_init(&s_sync, s_sync_buffer, sizeof(s_sync_buffer), 
      initial_values, ARRAY_LENGTH(initial_values),
      sync_tuple_changed_callback, sync_error_callback, NULL
  );

  request_weather();
}
开发者ID:DamiMartinez,项目名称:pebble-sdk-examples,代码行数:34,代码来源:weather.c

示例15: window_load

static void window_load(Window *window) {
  Layer *window_layer = window_get_root_layer(window);

  icon_layer = bitmap_layer_create(GRect(12, -5, 120, 120));
  layer_add_child(window_layer, bitmap_layer_get_layer(icon_layer));

  temperature_layer = text_layer_create(GRect(0, 100, 144, 68));
  text_layer_set_text_color(temperature_layer, GColorWhite);
  text_layer_set_background_color(temperature_layer, GColorClear);
  text_layer_set_font(temperature_layer, fonts_get_system_font(FONT_KEY_BITHAM_42_LIGHT));
  text_layer_set_text_alignment(temperature_layer, GTextAlignmentCenter);
  text_layer_set_text(temperature_layer, temperature);

  Tuplet initial_values[] = {
    TupletInteger(WEATHER_ICON_KEY, (uint8_t) 0),
    TupletCString(WEATHER_TEMPERATURE_KEY, "70\u00B0F"),
    TupletCString(WEATHER_REALFEEL_KEY, "70\u00B0F"),
  };
    
  app_sync_init(&sync, sync_buffer, sizeof(sync_buffer), initial_values, ARRAY_LENGTH(initial_values),
      sync_tuple_changed_callback, sync_error_callback, NULL);
  
  window_set_click_config_provider(window, (ClickConfigProvider) config_provider);

  layer_add_child(window_layer, text_layer_get_layer(temperature_layer));
}
开发者ID:sridvijay,项目名称:ForecasterForPebble,代码行数:26,代码来源:weather.c


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