コード例 #1
0
ファイル: main.c プロジェクト: Virophage/HFAStPebbleCallApp
/////////////////////////////////////////// TIMER //////////////////////////////////////////
static void exit_timer(struct tm* tick_time, TimeUnits units_changed) {
        if (exit_counter-- <= 0) {
          vibes_cancel();
          window_stack_pop_all(true);
          vibes_cancel();
        }
}
コード例 #2
0
ファイル: main.c プロジェクト: enurseitov/pebble-timer-plus
// Select raw click handler
static void prv_select_raw_click_handler(ClickRecognizerRef recognizer, void *ctx) {
  // stop vibration
  vibes_cancel();
  // animate and refresh
  drawing_start_reset_animation();
  layer_mark_dirty(main_data.layer);
}
コード例 #3
0
ファイル: alert_window.c プロジェクト: Herschee/Watchdog
static void tick_handler(struct tm *tick_time, TimeUnits units_changed) {
  static char s_uptime_buffer[32];
  vibes_short_pulse();
  alert_time--;
  if(alert_time <= 0 ){
    //TODO: write notification code
    tick_timer_service_unsubscribe();
    vibes_cancel();
    text_layer_set_text(s_alert_text_layer, "Timout Reached\n:(");
    
    // Prepare dictionary
    DictionaryIterator *iterator;
    app_message_outbox_begin(&iterator);
    
    // Write data
    char buff[100];
    if(persist_exists(PERSIST_KEY_PHONE_NUMBER)){
      persist_read_string(PERSIST_KEY_PHONE_NUMBER, buff, 100);
      dict_write_cstring(iterator, PERSIST_KEY_PHONE_NUMBER, buff);
    }
    if(persist_exists(PERSIST_KEY_NAME)){
      persist_read_string(PERSIST_KEY_NAME, buff, 100);
      dict_write_cstring(iterator, PERSIST_KEY_NAME, buff);
    }
    // Send the data!
    app_message_outbox_send();
    
  } else {
    snprintf(s_uptime_buffer, sizeof(s_uptime_buffer), BANNER_TEXT "\n" CLOCK_FORMAT_STRING, 
             alert_time/60, alert_time%60);
    text_layer_set_text(s_alert_text_layer, s_uptime_buffer);
  }
}
コード例 #4
0
ファイル: alarm.c プロジェクト: kgutwin/MavBBQ
void alarm_silence() {
	if (alarm_timer != NULL) {
		app_timer_cancel(alarm_timer);
		vibes_cancel();
		last_alarm_silence = time(NULL);
	}
	alarm_timer = NULL;
}
コード例 #5
0
ファイル: main.c プロジェクト: Virophage/HFAStPebbleCallApp
void up_click_handler(ClickRecognizerRef recognizer, void *context)
{
  text_layer_set_text(incoming_text, "Call Accepted");
  vibes_cancel();
  confirm_vibe();
  send_int(KEY_BUTTON_EVENT, BUTTON_EVENT_UP);
  call_counter = 10;
  tick_timer_service_subscribe(SECOND_UNIT, timer);
}
コード例 #6
0
ファイル: main.c プロジェクト: Virophage/HFAStPebbleCallApp
void down_click_handler(ClickRecognizerRef recognizer, void *context)
{
  text_layer_set_text(incoming_text, "Declining Call");
  vibes_cancel();
  confirm_vibe();
  send_int(KEY_BUTTON_EVENT, BUTTON_EVENT_DOWN);
  exit_counter = 2;
  tick_timer_service_subscribe(SECOND_UNIT, exit_timer);
}
void nw_vibrate(VibePattern* vibePattern, uint16_t totalLength)
{
    vibes_cancel();
    vibes_enqueue_custom_pattern(*vibePattern);

    vibrating = true;
    app_timer_register(totalLength, vibration_stopped, NULL);

}
コード例 #8
0
ファイル: main.c プロジェクト: robisodd/vibrate
// Pulse-Width Modulation Vibration
// strength: pwm ranges from 0 - 10, <0 is fully off, >10 is fully on
// duration: duration in milliseconds (must be > 0)
void vibes_pwm(int32_t strength, uint32_t duration) {
  uint32_t pwm_segments[MAX_PWM_DURATION/7], pwm_seglen;
  if(strength < 0) {
    vibes_cancel();
  } else if(strength > 10) {
    pwm_segments[0] = duration;  // on for [duration] (in ms)
    VibePattern pwm_pat = {.durations = pwm_segments, .num_segments = 1};
    vibes_enqueue_custom_pattern(pwm_pat);
  } else {
    if(duration > MAX_PWM_DURATION) duration = MAX_PWM_DURATION;
コード例 #9
0
ファイル: main.c プロジェクト: Virophage/HFAStPebbleCallApp
void select_click_handler(ClickRecognizerRef recognizer, void *context)
{
  vibes_cancel();
  send_int(KEY_BUTTON_EVENT, BUTTON_EVENT_SELECT);
  confirm_vibe();
  
  reply_window = window_create();
  window_set_window_handlers(reply_window, (WindowHandlers) {
    .load = replywindow_load,
    .unload = replywindow_unload,
  });
コード例 #10
0
ファイル: main.c プロジェクト: enurseitov/pebble-timer-plus
// Rewind timer if button is clicked to stop vibration
static bool main_timer_rewind(void) {
  // check if timer is vibrating
  if (timer_is_vibrating()) {
    vibes_cancel();
    main_data.control_mode = ControlModeEditSec;
    timer_rewind();
    drawing_update();
    return true;
  }
  return false;
}
コード例 #11
0
ファイル: wakeup.c プロジェクト: watadarkstar/pebble-spin-me
static void set_alarm_on(bool on){
  if(!on){
    // off state
    vibes_cancel();
    set_spinning(false);
    window_stack_remove(s_spin_window, true);
    return;
  } 
  // on state
  spins = 0;
  set_spinning(false);
}
コード例 #12
0
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();
}
コード例 #13
0
static void in_received_delete_vibration_handler(DictionaryIterator *received) {
    DBG_LOG(APP_LOG_LEVEL_DEBUG, "in_received_delete_vibration_handler");

    Tuple *attributeTuple = dict_find(received, KEY_ATTRIBUTE);
    switch (attributeTuple->value->uint8) {
    case VIBRATION_ATTRIBUTE_VIBRATE: {
        vibes_cancel();
    }   break;
    default:
        // not support
        pebble_set_error_code(ERROR_NOT_SUPPORT_ATTRIBUTE);
        break;
    }
}
コード例 #14
0
ファイル: pwm_vibrate.c プロジェクト: anniexie/sunshine
bool vibes_prepare_custom_pwm_pattern(VibePatternPWM *pwmPat) {
   bool isFull=false;
   
   vibes_cancel(); //bad idea to write to the global pattern while it is being used by an existing vibe
                   //TODO: create double-buffer so can be preparing one while another is playing?
                     
   
   gPat.num_segments = 0;
   for(unsigned int i=0; i<pwmPat->num_segments; i+=2) {
      isFull = append_pulse(&gPat, pwmPat->durations[i], pwmPat->durations[i+1]);
      if(isFull) break; //no sense trying to add more if it is full...
   }
   
   return isFull;
}
コード例 #15
0
ファイル: main.c プロジェクト: enurseitov/pebble-timer-plus
// Back click handler
static void prv_back_click_handler(ClickRecognizerRef recognizer, void *ctx) {
  // cancel vibrations
  vibes_cancel();
  // get time parts
  uint16_t hr, min, sec;
  timer_get_time_parts(&hr, &min, &sec);
  // change control mode
  if ((hr && main_data.control_mode == ControlModeEditMin) ||
      main_data.control_mode == ControlModeEditSec) {
    main_data.control_mode--;
  } else {
    window_stack_pop(true);
  }
  // refresh
  drawing_update();
  layer_mark_dirty(main_data.layer);
}
コード例 #16
0
void handle_accel_tap(AccelAxisType axis, int32_t direction)
{
    if (busy) return;
    if (callEstablished) return;
    if (Accelwork) return;

    bool MoveToPlusY = direction == -1 && axis == ACCEL_AXIS_Y;
    bool MoveToMinY = direction == 1 && axis == ACCEL_AXIS_Y;

    if (MoveToPlusY && MoveToMinY) {
        vibes_cancel();
        sendAction(3);
        Accelwork = true;
        APP_LOG(APP_LOG_LEVEL_DEBUG, "Tap work");
    } else
    {   APP_LOG(APP_LOG_LEVEL_DEBUG, "Tap not work");
    }
}
コード例 #17
0
ファイル: alert_window.c プロジェクト: Herschee/Watchdog
static void alert_window_unload(Window *window) {
  // Destroy output TextLayer
  vibes_cancel();
  tick_timer_service_unsubscribe();
  text_layer_destroy(s_alert_text_layer);
}
コード例 #18
0
ファイル: pwm_vibrate.c プロジェクト: anniexie/sunshine
void vibes_play_current_custom_pwm_pattern() {
   vibes_cancel(); //unpredictable behaviour if don't clear out any running vibes first...
   vibes_enqueue_custom_pattern(gPat);
}
コード例 #19
0
ファイル: helpers.c プロジェクト: epageron/PebbleApps
void stop_vibrate() {
   vibes_cancel();
}