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


C++ persist_write_int函数代码示例

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


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

示例1: inbox_received_handler

static void inbox_received_handler(DictionaryIterator *iter, void *context) {
  
  APP_LOG(APP_LOG_LEVEL_DEBUG, "Inbox called!");
  // Color Scheme?
  Tuple *color_red_t = dict_find(iter, KEY_COLOR_RED);
  Tuple *color_green_t = dict_find(iter, KEY_COLOR_GREEN);
  Tuple *color_blue_t = dict_find(iter, KEY_COLOR_BLUE);
  if(color_red_t && color_green_t && color_blue_t) {
  APP_LOG(APP_LOG_LEVEL_DEBUG, "Got new Background RGB values!");
  // Apply the color, if available
  #if defined(PBL_BW)
    window_set_background_color(s_main_window, GColorWhite);
  #elif defined(PBL_COLOR)
    int red = color_red_t->value->int32;
    int green = color_green_t->value->int32;
    int blue = color_blue_t->value->int32;
  
    // Persist values
    persist_write_int(KEY_COLOR_RED, red);
    persist_write_int(KEY_COLOR_GREEN, green);
    persist_write_int(KEY_COLOR_BLUE, blue);
  
    GColor bg_color = GColorFromRGB(red, green, blue);
    window_set_background_color(s_main_window, bg_color);
    APP_LOG(APP_LOG_LEVEL_DEBUG, "Set new background color!");
  #endif
  }  
}
开发者ID:KennethSchlatter,项目名称:ASL-WatchFace,代码行数:28,代码来源:main.c

示例2: inbox_received_handler

static void inbox_received_handler(DictionaryIterator *iter, void *context) {
  APP_LOG(APP_LOG_LEVEL_INFO, "Tuple read");
  Tuple *invert_face_t = dict_find(iter, KEY_INVERT_FACE);
  Tuple *bluetooth_vibration_t = dict_find(iter, KEY_BLUETOOTH_VIBRATION);
  Tuple *show_date_t = dict_find(iter, KEY_SHOW_DATE);
  
  if(invert_face_t){
    invert_face = invert_face_t->value->int8;
    persist_write_int(KEY_INVERT_FACE, invert_face);
    APP_LOG(APP_LOG_LEVEL_INFO, "Recevied invert info");
  }
  
  if(bluetooth_vibration_t){
    bluetooth_vibration = bluetooth_vibration_t->value->int8;
    persist_write_int(KEY_BLUETOOTH_VIBRATION, bluetooth_vibration);
    APP_LOG(APP_LOG_LEVEL_INFO, "Recevied bluetooth info");
  }
  
  if(show_date_t){
    show_date = show_date_t->value->int8;
    persist_write_int(KEY_SHOW_DATE, show_date);
    APP_LOG(APP_LOG_LEVEL_INFO, "Recevied date info");
  }

  update_layers();
}
开发者ID:turnervink,项目名称:CUTOFF,代码行数:26,代码来源:main.c

示例3: readConfig

void readConfig() {
	if (persist_exists(CONFIG_KEY_DATEORDER)) {
		USDate = persist_read_int(CONFIG_KEY_DATEORDER);
	} else {
		USDate = 1;
		persist_write_int(CONFIG_KEY_DATEORDER, USDate);
	}
	
	if (persist_exists(CONFIG_KEY_WEEKDAY)) {
		showWeekday = persist_read_int(CONFIG_KEY_WEEKDAY);
	} else {
		showWeekday = 0;
		persist_write_int(CONFIG_KEY_WEEKDAY, showWeekday);
	}
	
	if (persist_exists(CONFIG_KEY_LANG)) {
		curLang = persist_read_int(CONFIG_KEY_LANG);
	} else {
		curLang = LANG_ENGLISH;
		persist_write_int(CONFIG_KEY_LANG, curLang);
	}
	
	if (persist_exists(CONFIG_KEY_STRIPES)) {
		stripedDigits = persist_read_int(CONFIG_KEY_STRIPES);
	} else {
		stripedDigits = 1;
		persist_write_int(CONFIG_KEY_STRIPES, stripedDigits);
	}
	
	APP_LOG(APP_LOG_LEVEL_DEBUG, "Stored config (dateorder=%d, weekday=%d, lang=%d, stripedDigits=%d)",
			USDate, showWeekday, curLang, stripedDigits);
}
开发者ID:dmitre,项目名称:Blockslide-Date_2.0_reverce-pebble,代码行数:32,代码来源:Blockslide-Date_2.0.c

示例4: save_charge_log

void save_charge_log(ChargeLog* charge_log)
{
  int32_t log_count = 0;
  int32_t log_index = 0;
  
  if (persist_exists(PERSIST_KEY_LOG_COUNT)) {
    log_count = persist_read_int(PERSIST_KEY_LOG_COUNT);
  }
      
  if (persist_exists(PERSIST_KEY_LOG_INDEX)) {
    log_index = persist_read_int(PERSIST_KEY_LOG_INDEX);
  }
  
  log_count++;
  
  uint32_t key_log = PERSIST_KEY_LOG_BASE + (log_index + log_count - 1) % MAX_LOG_COUNT;
  
  if (log_count > MAX_LOG_COUNT) {
    log_count--;
    log_index++;
  }
  
  persist_write_int(PERSIST_KEY_LOG_COUNT, log_count);
  persist_write_int(PERSIST_KEY_LOG_INDEX, log_index);
  persist_write_data(key_log, charge_log, sizeof(*charge_log));
  
  if (launch_reason() != APP_LAUNCH_WAKEUP) {
    layer_mark_dirty(s_graph_layer);
  }
}
开发者ID:tmatz,项目名称:PebbleBatteryLog,代码行数:30,代码来源:main.c

示例5: write_blk_buf_to_persist

static void write_blk_buf_to_persist(){
  /* the persist_read_int(I_BLK_PERSIST_KEY) is NOT a count, it is the current index
  * but 1-indexced, so 1 is the first block and zero is the empty state */

  if(persist_read_int(I_BLK_PERSIST_KEY) < N_BLK_PERSIST){
    // set the index of the current block
    persist_write_int(I_BLK_PERSIST_KEY,persist_read_int(I_BLK_PERSIST_KEY)+1);
    persist_write_data(persist_read_int(I_BLK_PERSIST_KEY),
                       blk_buf,((SIZE_SUMM*N_SUMM_BLK)+SIZE_BLK_HEAD));
  }

  if(bluetooth_connection_service_peek()){
    persist_write_int(WORKER_START_FORE_APP_REASON_PERSIST_KEY,
      WFAWR_PUSH_ALL_DATA_TO_SERVER);
      summ_since_trans_server = 0; // once try to go to server, reset
      worker_launch_app();
  } else if(persist_read_int(I_BLK_PERSIST_KEY) >= (N_BLK_PERSIST-1) ){
    // if the I_BLK_PERSIST_KEY is greater than 90% of storage, then prompt
    // that need to connect the phone
    persist_write_int(WORKER_START_FORE_APP_REASON_PERSIST_KEY,
      WFAWR_MEMORY_LOW_REMINDER);
    worker_launch_app();
  }
  // else if(){
  //   // reset the counter for consecutive summaries
  //   persist_write_int(WORKER_START_FORE_APP_REASON_PERSIST_KEY,
  //     WFAWR_WEAR_REMINDER);
  //   worker_launch_app();
  // }

}
开发者ID:avibagla,项目名称:pebblewatch,代码行数:31,代码来源:ProjectK_worker.c

示例6: handle_deinit

void handle_deinit(void) {
  tick_timer_service_unsubscribe();

  persist_write_string(MESSAGE_KEY_DATE_FORMAT_KEY,       PersistDateFormat);
  persist_write_int(MESSAGE_KEY_BT_VIBRATE_KEY,           PersistBTLoss);
  persist_write_int(MESSAGE_KEY_LOW_BATTERY_KEY,          PersistLow_Batt);
  
  battery_state_service_unsubscribe();
  bluetooth_connection_service_unsubscribe();
  app_focus_service_unsubscribe();

  text_layer_destroy(text_time_layer);
  text_layer_destroy(text_date_layer);
  text_layer_destroy(text_dayname_layer);
  text_layer_destroy(text_battery_layer);

  layer_destroy(BatteryLineLayer);
  layer_destroy(BTLayer);

  gbitmap_destroy(image);
  bitmap_layer_destroy(image_layer);

  fonts_unload_custom_font(fontHelvNewLight20);
  fonts_unload_custom_font(fontRobotoBoldSubset40);
  fonts_unload_custom_font(fontRobotoBoldSubset45);


  window_destroy(window);
}
开发者ID:DHKaplan,项目名称:Planetary,代码行数:29,代码来源:Planetary.c

示例7: init

static void init(void) {
	if(!persist_exists(CONFIG_WORK)){
		persist_write_int(CONFIG_WORK,25);
		persist_write_int(CONFIG_REST,5);
	}
	show_mainwindow();
}
开发者ID:bhwarren,项目名称:pomopebble,代码行数:7,代码来源:appLaunch.c

示例8: in_received_handler

static void in_received_handler(DictionaryIterator *received, void *context) {
  APP_LOG(APP_LOG_LEVEL_DEBUG, "Received config");
  Tuple *tuple = dict_find(received, MSG_START_TIME);
  if (tuple) {
    start_time = tuple->value->int32;
    persist_write_int(MSG_START_TIME, start_time);
  }
  tuple = dict_find(received, MSG_END_TIME);
  if (tuple) {
    end_time = tuple->value->int32;
    persist_write_int(MSG_END_TIME, end_time);
  }
  tuple = dict_find(received, MSG_TEXT_OTSLUJIL);
  if (tuple) {
    strcpy(text_otslujul, tuple->value->cstring);
    persist_write_string(MSG_TEXT_OTSLUJIL, text_otslujul);
  }
  tuple = dict_find(received, MSG_TEXT_OSTALOS);
  if (tuple) {
    strcpy(text_ostalos, tuple->value->cstring);
    persist_write_string(MSG_TEXT_OSTALOS, text_ostalos);
  }
  tuple = dict_find(received, MSG_TEXT_UJE);
  if (tuple) {
    strcpy(text_uje, tuple->value->cstring);
    persist_write_string(MSG_TEXT_UJE, text_uje);
  }
  time_t now = time(NULL);
  handle_tick(localtime(&now), 0);
}
开发者ID:ClusterM,项目名称:pebble-dembel,代码行数:30,代码来源:dembel.c

示例9: handle_deinit

void handle_deinit() {
  app_message_deregister_callbacks();
  battery_state_service_unsubscribe();
  tick_timer_service_unsubscribe();
  if (has_config) {
    persist_write_int(SECONDS_MODE, seconds_mode);
    persist_write_int(BATTERY_MODE, battery_mode);
    persist_write_int(DATE_MODE, date_mode);
    persist_write_int(BLUETOOTH_MODE, bluetooth_mode);
    APP_LOG(APP_LOG_LEVEL_DEBUG, "Wrote config");
  } else {
    APP_LOG(APP_LOG_LEVEL_DEBUG, "Did not write config");
  }
  fonts_unload_custom_font(font);
  gpath_destroy(sec_path);
  gpath_destroy(min_path);
  gpath_destroy(hour_path);
  inverter_layer_destroy(inverter_layer);
#if DEBUG
  text_layer_destroy(debug_layer);
#endif
  layer_destroy(hands_layer);
  bitmap_layer_destroy(logo_layer);
  gbitmap_destroy(logo);
  bitmap_layer_destroy(battery_layer);
  for (int i = 0; i < 22; i++)
    gbitmap_destroy(battery_images[i]);
  bitmap_layer_destroy(bluetooth_layer);
  for (int i = 0; i < 2; i++)
    gbitmap_destroy(bluetooth_images[i]);
  layer_destroy(background_layer);
  layer_destroy(date_layer);
  window_destroy(window);
}
开发者ID:agreen,项目名称:PebbleONE,代码行数:34,代码来源:pebble_one.c

示例10: sync_changed_handler

static void sync_changed_handler(const uint32_t key,
                                 const Tuple *new_tuple,
                                 const Tuple *old_tuple,
                                 void *context) {
    bool dirty = false;
    APP_LOG(APP_LOG_LEVEL_DEBUG, "sync_changed: key %" PRIu32, key);
    switch (key) {
        case BACKGROUND_COLOR_KEY:
            if (pcb_background.argb != new_tuple->value->uint8) {
                pcb_background.argb = new_tuple->value->uint8;
                persist_write_int(BACKGROUND_COLOR_KEY, pcb_background.argb);
                dirty = true;
            }
            break;

        case SILKSCREEN_COLOR_KEY:
            if (pcb_silkscreen.argb != new_tuple->value->uint8) {
                pcb_silkscreen.argb = new_tuple->value->uint8;
                persist_write_int(SILKSCREEN_COLOR_KEY, pcb_silkscreen.argb);
                dirty = true;
            }
            break;

        default:
            // ignore unknown keys
            break;
    }
    if (dirty && s_canvas_layer) {
        layer_mark_dirty(s_canvas_layer);
    }
}
开发者ID:llamahunter,项目名称:resistor-time,代码行数:31,代码来源:resistor.c

示例11: inbox_received_callback

static void inbox_received_callback(DictionaryIterator *iterator, void *context) {
  APP_LOG(APP_LOG_LEVEL_INFO, "Message received!");
  Tuple *t = dict_read_first(iterator);

  // Process all pairs present
  while(t != NULL) {
    // Process this pair's key
    switch (t->key) {
      case KEY_PHONE:
        persist_write_string(PERSIST_KEY_PHONE_NUMBER, t->value->cstring);
        break;
      case KEY_NAME:
        persist_write_string(PERSIST_KEY_NAME, t->value->cstring);
        break;
      case KEY_TIMER:
        persist_write_int(PERSIST_KEY_INTERVAL_TIME, t->value->int32);
        break;
      case KEY_VIBRATE:
        persist_write_int(PERSIST_KEY_BUZZ_TIME, t->value->int32);
        break;
    }

    // Get next pair, if any
    t = dict_read_next(iterator);
  }
}
开发者ID:Herschee,项目名称:Watchdog,代码行数:26,代码来源:clock.c

示例12: in_recv_handler

static void in_recv_handler(DictionaryIterator *iterator, void *context)
{
  //Get Tuple
  Tuple *t = dict_read_first(iterator);
  while (t)
  {
    switch(t->key) {
    case KEY_INVERT:
      //It's the KEY_INVERT key
      inverted = (strcmp(t->value->cstring, "si") == 0);
      layer_set_hidden((Layer *)ILFondo, inverted);
 	  persist_write_bool(KEY_INVERT, inverted);
      break;
	  
	case KEY_IDIOMA:
      //It's the KEY_INVERT key
      if(strcmp(t->value->cstring, "1")==0)
      {
        //Set and save as inverted
		idioma=1;  
        persist_write_int(KEY_IDIOMA, 1);
      }
      else if(strcmp(t->value->cstring, "0")==0)
      {
        //Set and save as not inverted
		idioma = 0;
        persist_write_int(KEY_IDIOMA, 0);
      }
      break;
    }
	t = dict_read_next(iterator);
  }
}
开发者ID:manelto,项目名称:pizarra,代码行数:33,代码来源:main.c

示例13: save_persistent_data

static void save_persistent_data() {
    uint32_t today = get_today();
    persist_write_int(DATE_SAVE, today);
    persist_write_int(CANCELED_COUNT, rounds_canceled);
    persist_write_int(COMPLETED_COUNT, rounds_done);
    
}
开发者ID:klassenpeter,项目名称:pebble_tomato,代码行数:7,代码来源:main.c

示例14: storage_store

void storage_store(){
	APP_LOG(APP_LOG_LEVEL_INFO,"storage_store()");
	APP_LOG(APP_LOG_LEVEL_INFO,"max_cell_size: %d timer_size: %d laps_size: %d clock_size: %d",PERSIST_DATA_MAX_LENGTH,sizeof(Timer),sizeof(Laps),sizeof(Clock));
	
	int result;
	uint8_t c=timers_count();
	
	result=persist_write_int(STORAGE_KEY_VERSION,STORAGE_VERSION);
	if(result<0){
		APP_LOG(APP_LOG_LEVEL_ERROR,"write error count %d in storage %d #%d",c,STORAGE_KEY_COUNT,result);  
		return;
	}
	
	result=persist_write_int(STORAGE_KEY_COUNT,c);
	if(result<0){
		APP_LOG(APP_LOG_LEVEL_ERROR,"write error count %d in storage %d #%d",count_total(count),STORAGE_KEY_COUNT,result); 
		return;
	}
	APP_LOG(APP_LOG_LEVEL_INFO,"timer count %d",count_total(count));
	
	Timer* timer;
	for(uint8_t i=0;i<c;i++){
		timer=timers_get(i);
		result=persist_write_data(STORAGE_KEY_DATA+i,timer,sizeof(Timer));
		if(result<0){
			APP_LOG(APP_LOG_LEVEL_ERROR,"write error timer %d in storage %d #%d",i,STORAGE_KEY_DATA+i,result); 
			continue;
		}
		APP_LOG(APP_LOG_LEVEL_INFO,"stored timer %d",i);
	}
	APP_LOG(APP_LOG_LEVEL_INFO,"stored");
}
开发者ID:Stopka,项目名称:StopWatch,代码行数:32,代码来源:timers.c

示例15: data_deinit

void data_deinit() {
  // Store current values
  for(int i = 0; i < DataNumBoolKeys; i++) {
    persist_write_bool(i, s_bool_settings[i]);
  }
  persist_write_int(DataKeyForegroundColor, s_foreground.argb);
  persist_write_int(DataKeyBackgroundColor, s_background.argb);
}
开发者ID:C-D-Lewis,项目名称:beam-up,代码行数:8,代码来源:data.c


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