コード例 #1
0
static void select_click_handler(ClickRecognizerRef recognizer, void *context) {
  // Check to see if the worker is currently active
  bool running = app_worker_is_running();

  // Toggle running state
  AppWorkerResult result;
  if(running) {
    result = app_worker_kill();

    if(result == APP_WORKER_RESULT_SUCCESS) {
      text_layer_set_text(s_ticks_layer, "Worker stopped!");
    } else {
      text_layer_set_text(s_ticks_layer, "Error killing worker!");
    }
  } else {
    result = app_worker_launch();

    if(result == APP_WORKER_RESULT_SUCCESS) {
      text_layer_set_text(s_ticks_layer, "Worker launched!");
    } else {
      text_layer_set_text(s_ticks_layer, "Error launching worker!");
    }
  }

  APP_LOG(APP_LOG_LEVEL_INFO, "Result: %d", result);
}
コード例 #2
0
ファイル: logic.c プロジェクト: npenkov/pebslee-pebble
void stop_motion_capturing() {
    // AppWorkerMessage msg_data = {
    //     .data0 = 0
    // };
    // // Send the data to the background app
    // app_worker_send_message(APP_CMD_STOP_CAPTURING, &msg_data);

    // Stop the background worker
    AppWorkerResult result = app_worker_kill();
}
コード例 #3
0
void process_tuple(Tuple *t){
    int key = t->key;
    int value = t->value->int32;
    APP_LOG(APP_LOG_LEVEL_DEBUG, "Loaded key %d with value %d.", key, value);
    switch (key) {
        case APP_KEY_INVERT:
            data_framework_local_settings.lightTheme = value;
            break;
        case APP_KEY_WEATHER_FORMAT:
            data_framework_local_settings.fahrenheit = value;
            if(data_framework_local_settings.fahrenheit){
                data_framework_local_settings.previousTemp = (1.8*(data_framework_local_settings.previousTempRaw-273)+32);
            }
            else{
                data_framework_local_settings.previousTemp = data_framework_local_settings.previousTempRaw-273;
            }
            break;
        case APP_KEY_ANIMATIONS:
            data_framework_local_settings.animations = value;
            break;
        case APP_KEY_AUTO_OPEN:
            data_framework_local_settings.autoOpen = value;
            if(data_framework_local_settings.autoOpen){
                app_worker_launch();
            }
            else{
                app_worker_kill();
            }
            break;
        case APP_KEY_DATE_FORMAT:
            data_framework_local_settings.altDateFormat = value;
            break;
        case APP_KEY_TEMPERATURE:
            data_framework_local_settings.previousTemp = value;
            data_framework_local_settings.previousTempRaw = value;
            if(data_framework_local_settings.fahrenheit){
                data_framework_local_settings.previousTemp = (1.8*(value-273)+32);
            }
            else{
                data_framework_local_settings.previousTemp = value-273;
            }
            break;
        case APP_KEY_CONDITION:
            data_framework_local_settings.previousCondition = value;
            break;
        case APP_KEY_REDUCE_ANIMATIONS:
            data_framework_local_settings.reduceAnimations = value;
            break;
    }
}
コード例 #4
0
ファイル: clicks.c プロジェクト: gitoren/Android
//---------------------------------------------------------------------------------
// Click Handlers
//---------------------------------------------------------------------------------
//------- Select Click Handlers ----------
static void select_click_handler(ClickRecognizerRef recognizer, void *context) {
    // Toggle running state
    if (app_worker_is_running()) {
        if (app_worker_kill() == APP_WORKER_RESULT_SUCCESS) {
            text_layer_set_text(text_layer, "Worker stopped!");
            APP_LOG(APP_LOG_LEVEL_INFO, "Worker Stopped");
        } else {
            text_layer_set_text(text_layer, "Error killing worker!");
            APP_LOG(APP_LOG_LEVEL_INFO, "Error Killing Worker");
        }
    } else {
        if (app_worker_launch() == APP_WORKER_RESULT_SUCCESS) {
            text_layer_set_text(text_layer, "Worker launched!");
            APP_LOG(APP_LOG_LEVEL_INFO, "Worker Launched");
        } else {
            text_layer_set_text(text_layer, "Error launching worker!");
            APP_LOG(APP_LOG_LEVEL_INFO, "Error Launching Worker");
        }
    }
}