本文整理汇总了C++中TupletCString函数的典型用法代码示例。如果您正苦于以下问题:C++ TupletCString函数的具体用法?C++ TupletCString怎么用?C++ TupletCString使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TupletCString函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: tick_handler
/*
* Tick-Handler - executes once every second using watch's internal clock.
* Switched every other second between getting most recent temp (if desired) and checking for tripped alarm.
*/
static void tick_handler(struct tm *tick_time, TimeUnits units_changed) {
if (tickTimerMod % 2 == 0){
if (wantAverage && !standbyEngaged && !tripped){
DictionaryIterator *iter;
app_message_outbox_begin(&iter);
int key = 0;
// send the message "b" to the phone, using key #0
Tuplet value = TupletCString(key, "b");
dict_write_tuplet(iter, &value);
app_message_outbox_send();
}
}
else{
//checks if alarm has been tripped, checks to see every 10 seconds if not
if (tripped){
text_layer_set_text(hello_layer, "INTRUDER ALERT!!!");
vibes_double_pulse();
}
else {
DictionaryIterator *iter;
app_message_outbox_begin(&iter);
int key = 0;
// send the message "t" to the phone, using key #0
Tuplet value = TupletCString(key, "t");
dict_write_tuplet(iter, &value);
app_message_outbox_send();
}
}
tickTimerMod += 1;
}
示例2: 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
}
示例3: 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();
}
示例4: up_double_click_handler
/*
* Responds to double up button clicks. When !tripped, asks the server to put the Arduino in
* or out of standby mode and records it. When tripped, resets the alarm on the server and Arduino.
*/
void up_double_click_handler(ClickRecognizerRef recognizer, void *context) {
if (!tripped){
standbyEngaged = !standbyEngaged;
wantAverage = 0;
//text_layer_set_text(hello_layer, "UP!");
DictionaryIterator *iter;
app_message_outbox_begin(&iter);
int key = 0;
// send the message "hello?" to the phone, using key #0
Tuplet value = TupletCString(key, "s");
dict_write_tuplet(iter, &value);
app_message_outbox_send();
}
else {
tripped = 0;
//text_layer_set_text(hello_layer, "UP!");
DictionaryIterator *iter;
app_message_outbox_begin(&iter);
int key = 0;
// send the message "hello?" to the phone, using key #0
Tuplet value = TupletCString(key, "r");
dict_write_tuplet(iter, &value);
app_message_outbox_send();
}
}
示例5: 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));
}
示例6: 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();
}
示例7: menu_select_callback
static void menu_select_callback(int index, void *ctx) {
if(index==0)
send_to_phone(TupletCString(103, "BOAT"));
else if(index==1)
send_to_phone(TupletCString(103, "PIN"));
vibes_short_pulse();
window_stack_pop(true); //this window
}
示例8: window_load
// This function will set up all the text layers and will initialize the App_Sync.
static void window_load(Window *window) {
Layer *window_layer = window_get_root_layer(window);
//setting up the layer that displays the cardinal direction.
direction_layer = text_layer_create(GRect(0, 60, 144, 68));
text_layer_set_text_color(direction_layer, GColorBlack);
text_layer_set_background_color(direction_layer, GColorClear);
text_layer_set_font(direction_layer, fonts_get_system_font(FONT_KEY_BITHAM_42_BOLD));
text_layer_set_text_alignment(direction_layer, GTextAlignmentCenter);
layer_add_child(window_layer, text_layer_get_layer(direction_layer));
// Setting up top-most text layer.
top_layer = text_layer_create(GRect(50, 0, 100, 25));
text_layer_set_text_color(top_layer, GColorBlack);
text_layer_set_background_color(top_layer, GColorClear);
text_layer_set_font(top_layer, fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD));
text_layer_set_text_alignment(top_layer, GTextAlignmentCenter);
layer_add_child(window_layer, text_layer_get_layer(top_layer));
text_layer_set_text(top_layer, "Numeric");
// Setting up bottom-most text layer.
bottom_layer = text_layer_create(GRect(50, 140, 100, 30));
text_layer_set_text_color(bottom_layer, GColorBlack);
text_layer_set_background_color(bottom_layer, GColorClear);
text_layer_set_font(bottom_layer, fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD));
text_layer_set_text_alignment(bottom_layer, GTextAlignmentCenter);
layer_add_child(window_layer, text_layer_get_layer(bottom_layer));
text_layer_set_text(bottom_layer, "Character");
// Setting up "Open App" text layer.
init_layer = text_layer_create(GRect(0, 45, 144, 80));
text_layer_set_text_color(init_layer, GColorBlack);
text_layer_set_background_color(init_layer, GColorClear);
text_layer_set_font(init_layer, fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD));
text_layer_set_text_alignment(init_layer, GTextAlignmentCenter);
text_layer_set_text(init_layer, "Please open the Android companion app, then choose a compass type.");
layer_add_child(window_layer, text_layer_get_layer(init_layer));
Tuplet initial_values[]= {
TupletCString(DIRECTION_KEY, "Loading...."),
TupletCString(NUM_DIRECTION_KEY, "Loading...."),
};
// Initializing App_Sync!
app_sync_init(&sync, sync_buffer, sizeof(sync_buffer), initial_values, ARRAY_LENGTH(initial_values), sync_tuple_changed_callback, sync_error_callback, NULL);
send_cmd();
}
示例9: send_change_units_message
/* Sends a request to change the units between celsius and fahrenheit */
void send_change_units_message() {
DictionaryIterator *iter;
app_message_outbox_begin(&iter);
if (celsius) {
Tuplet value = TupletCString(4, "Use celsius");
dict_write_tuplet(iter, &value);
} else {
Tuplet value = TupletCString(5, "Use Fahrenheit");
dict_write_tuplet(iter, &value);
}
app_message_outbox_send();
}
示例10: window_load
static void window_load(Window *window) {
Layer *window_layer = window_get_root_layer(window);
gridpower_layer = text_layer_create(GRect(0, 10, 144, 68));
text_layer_set_text_color(gridpower_layer, GColorBlack);
text_layer_set_background_color(gridpower_layer, GColorClear);
text_layer_set_font(gridpower_layer, fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD));
text_layer_set_text_alignment(gridpower_layer, GTextAlignmentLeft);
layer_add_child(window_layer, text_layer_get_layer(gridpower_layer));
dailyenery_layer = text_layer_create(GRect(0, 30, 144, 68));
text_layer_set_text_color(dailyenery_layer, GColorBlack);
text_layer_set_background_color(dailyenery_layer, GColorClear);
text_layer_set_font(dailyenery_layer, fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD));
text_layer_set_text_alignment(dailyenery_layer, GTextAlignmentLeft);
layer_add_child(window_layer, text_layer_get_layer(dailyenery_layer));
montlyenergy_layer = text_layer_create(GRect(0, 50, 144, 68));
text_layer_set_text_color(montlyenergy_layer, GColorBlack);
text_layer_set_background_color(montlyenergy_layer, GColorClear);
text_layer_set_font(montlyenergy_layer, fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD));
text_layer_set_text_alignment(montlyenergy_layer, GTextAlignmentLeft);
layer_add_child(window_layer, text_layer_get_layer(montlyenergy_layer));
yearlyenergy_layer = text_layer_create(GRect(0, 70, 144, 68));
text_layer_set_text_color(yearlyenergy_layer, GColorBlack);
text_layer_set_background_color(yearlyenergy_layer, GColorClear);
text_layer_set_font(yearlyenergy_layer, fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD));
text_layer_set_text_alignment(yearlyenergy_layer, GTextAlignmentLeft);
layer_add_child(window_layer, text_layer_get_layer(yearlyenergy_layer));
totalenergy_layer = text_layer_create(GRect(0, 90, 144, 68));
text_layer_set_text_color(totalenergy_layer, GColorBlack);
text_layer_set_background_color(totalenergy_layer, GColorClear);
text_layer_set_font(totalenergy_layer, fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD));
text_layer_set_text_alignment(totalenergy_layer, GTextAlignmentLeft);
layer_add_child(window_layer, text_layer_get_layer(totalenergy_layer));
Tuplet initial_values[] = {
TupletCString(SOLAR_GRIDPOWER, "Power:"),
TupletCString(SOLAR_DAILYENERGY, "Daily:"),
TupletCString(SOLAR_MONTHLYENERGY, "Monthly:"),
TupletCString(SOLAR_YEARLYENERGY, "Yearly:"),
TupletCString(SOLAR_TOTALENERGY, "Total:"),
};
app_sync_init(&sync, sync_buffer, sizeof(sync_buffer), initial_values, ARRAY_LENGTH(initial_values),
sync_tuple_changed_callback, sync_error_callback, NULL);
send_cmd(0);
}
示例11: menu_select_callback
static void menu_select_callback(int index, void *ctx) {
if(index==0)// 10 mins - 600 sec's
send_to_phone(TupletCString(104, "600"));
else if(index==1)
send_to_phone(TupletCString(104, "300")); //5 mins
else if(index==2) // 4 mins = 240 sec's
send_to_phone(TupletCString(104, "240"));
window_stack_pop(true); //this window
vibes_short_pulse();
//show_start_solution();
}
示例12: send_cmd
static void send_cmd(void) {
DictionaryIterator *iter;
app_message_outbox_begin(&iter);
if (iter == NULL) {
return;
}
Tuplet direction = TupletCString(0, index);
dict_write_tuplet(iter, &direction);
Tuplet load = TupletCString(2, "Loading...");
dict_write_tuplet(iter, &load);
dict_write_end(iter);
app_message_outbox_send();
}
示例13: controller_setmodel
void controller_setmodel(PropertyName propertyName, const char* const value) {
Tuplet values[] = {
TupletCString(propertyName, value)
};
app_sync_set(&s_sync, values, ARRAY_LENGTH(values));
modelChangedCallback(propertyName, value);
}
示例14: openweather_init
void openweather_init(void) {
// init forecast structure
forecast_data.day = calloc(OPENWEATHER_FCAST_DAYS, sizeof(ForecastDayType));
// init json parser
json_register_callbacks(object_callback, array_callback);
// Open channel
const int inbound_size = app_message_inbox_size_maximum();
const int outbound_size = app_message_outbox_size_maximum();
APP_LOG(APP_LOG_LEVEL_DEBUG, "Determined sizes: Inbox %u Outbox %u", inbound_size, outbound_size);
app_message_open(inbound_size, outbound_size);
// Init sync
Tuplet initial_values[] = {
TupletCString(OPENWEATHER_KEY, "")
};
app_sync_init(&sync, sync_buffer, sizeof(sync_buffer), initial_values, ARRAY_LENGTH(initial_values),
sync_tuple_changed_callback, sync_error_callback, NULL);
// Set update
set_timer(OPENWEATHER_REFRESH_INTERVAL);
}
示例15: 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 */);
}