예제 #1
0
int main() {
	app_message_register_outbox_sent(data_delivered);
	app_message_register_inbox_received(received_data);

	app_message_open(124, 50);

	DictionaryIterator *iterator;
	app_message_outbox_begin(&iterator);
	dict_write_uint8(iterator, 0, 0);
	dict_write_uint8(iterator, 1, 0);
	dict_write_uint16(iterator, 2, PROTOCOL_VERSION);
	#ifdef PBL_PLATFORM_APLITE
		dict_write_uint8(iterator, 3, 0);
	#else
		dict_write_uint8(iterator, 3, 1);
	#endif

	app_comm_set_sniff_interval(SNIFF_INTERVAL_REDUCED);
	app_message_outbox_send();

	switchWindow(0);
	app_event_loop();
	window_stack_pop_all(false);
	return 0;
}
void received_data(DictionaryIterator *received, void *context) {
	uint8_t packetId = dict_find(received, 0)->value->uint8;

	if (packetId == 3)
	{
		received_config(received);
		return;
	}
	else if (!gotConfig)
		return;

	if ((packetId == 0 || packetId == 4) && curWindow > 1)
	{
		switchWindow(1);
	}

	switch (curWindow)
	{
	case 0:
		menu_data_received(packetId, received);
		break;
	case 1:
		notification_received_data(packetId, received);
		break;
	case 2:
		list_data_received(packetId, received);
		break;
	}

	app_comm_set_sniff_interval(SNIFF_INTERVAL_REDUCED);
}
int main(void) {
	appmessage_max_size = app_message_inbox_size_maximum();
	if (appmessage_max_size > 4096)
		appmessage_max_size = 4096; //Limit inbox size to conserve RAM.

	#ifdef PBL_PLATFORM_APLITE
		//Aplite has so little memory, we can't squeeze much more than that out of appmessage buffer.
		appmessage_max_size = 124;
	#endif

	app_message_register_inbox_received(received_data);
	app_message_register_outbox_sent(sent_data);
	app_message_open(appmessage_max_size, 408);

	loadingMode = true;
	send_initial_packet();
	app_timer_register(3000, loading_retry_timer, NULL);

	switchWindow(0);
	app_event_loop();
	window_stack_pop_all(false);

	free(config_periodicVibrationPattern);

    AppLaunchReason appLaunchReason = launch_reason();
    if (appLaunchReason == APP_LAUNCH_PHONE && !config_dontClose) {
        // If app was launched by phone and close to last app is disabled, always exit to the watchface instead of to the menu
        exit_reason_set(APP_EXIT_ACTION_PERFORMED_SUCCESSFULLY);
    }

	return 0;
}
static void received_data(DictionaryIterator *received, void *context) {
	app_comm_set_sniff_interval(SNIFF_INTERVAL_REDUCED);

	uint8_t destModule = dict_find(received, 0)->value->uint8;
	uint8_t packetId = dict_find(received, 1)->value->uint8;
	bool autoSwitch = dict_find(received, 999) != NULL;

	if (destModule == 0 && packetId == 0)
	{
		received_config(received);
		return;
	}

	if (!gotConfig) //Do not react to anything until we got config
		return;

	if (destModule == 2)
	{
		if (curWindow != 2)
		{
			if (autoSwitch)
				switchWindow(2);
			else
				return;
		}

		list_window_data_received(packetId, received);

	}
	else
	{
		if (curWindow != 1)
		{
			if (autoSwitch)
				switchWindow(1);
			else
				return;
		}

		nw_received_data_callback(destModule, packetId, received);
	}
}
예제 #5
0
void received_data(DictionaryIterator *received, void *context) {
	uint8_t packetId = dict_find(received, 0)->value->uint8;

	if (packetId == 5 && curWindow != 10)
	{
		if (curWindow == 0)
			window_stack_pop(false);

		switchWindow(10);
	}
	else if (packetId == 3 && curWindow != 3)
	{
		switchWindow(3);
	}

	switch (curWindow)
	{
	case 0:
		menu_data_received(packetId, received);
		break;
	case 1:
		filter_data_received(packetId, received);
		break;
	case 2:
		contacts_data_received(packetId, received);
		break;
	case 3:
		np_data_received(packetId, received);
		break;
	case 4:
		cl_data_received(packetId, received);
		break;

	case 10:
		callscreen_received_data(packetId, received);
		break;

	}

	app_comm_set_sniff_interval(SNIFF_INTERVAL_REDUCED);
	app_comm_set_sniff_interval(SNIFF_INTERVAL_NORMAL);
}
예제 #6
0
int main(void) {
	app_message_register_inbox_received(received_data);
	app_message_register_outbox_sent(data_sent);
	app_message_open(768, 512);

	switchWindow(WINDOW_MAIN_MENU);

	app_timer_register(300, timerTriggered, NULL);

	app_event_loop();
	return 0;
}
예제 #7
0
파일: w_home.cpp 프로젝트: link8001/aip
/******************************************************************************
  * version:    1.0
  * author:     link
  * date:       2015.12.10
  * brief:      按钮功能
******************************************************************************/
void w_Home::buttonJudge(int id)
{
    switch (id){
    case W_SYST:
        emit switchWindow(W_SYST);
        break;
    case W_MODL:
        emit switchWindow(W_MODL);
        break;
    case W_DATA:
        emit switchWindow(W_DATA);
        break;
    case W_TEST:
        emit switchWindow(W_TEST);
        break;
    case W_EXIT:
        emit switchWindow(W_EXIT);
        break;
    default:
        break;
    }
}
예제 #8
0
파일: w_hide.cpp 프로젝트: link8001/aip
/******************************************************************************
  * version:    1.0
  * author:     link
  * date:       2016.01.28
  * brief:      按钮功能
******************************************************************************/
void w_Hide::buttonJudge(int id)
{
    switch(id){
    case W_SYST_EXIT:
        emit switchWindow(W_SYST);
        break;
    case W_SYST_SAVE:
        emit saveAll();
        break;
    default:
        break;
    }
}
예제 #9
0
파일: w_conf.cpp 프로젝트: link8001/aip
/******************************************************************************
  * version:    1.0
  * author:     link
  * date:       2015.12.10
  * brief:      按钮功能
******************************************************************************/
void w_Conf::buttonJudge(int id)
{
    int index;
    switch (id){
    case W_CONF_EXIT:
        emit switchWindow(W_TEST);
        break;
    case W_CONF_SAVE:
        if (wAll != NULL){
            CONF = wAll->output();
            wAll->setHardware();
        }
        if (wRes != NULL){
            RES = wRes->output();
            wRes->setHardware();
        }
        if (wOpp != NULL){
            OPP = wOpp->output();
            wOpp->setHardware();
        }
        if (wIns != NULL){
            INS = wIns->output();
            wIns->setHardware();
        }
        if (wAcv != NULL){
            ACV = wAcv->output();
            wAcv->setHardware();
        }
        if (wDcv != NULL){
            DCV = wDcv->output();
            wDcv->setHardware();
        }
        if (wItt != NULL){
            ITT = wItt->output();
            wItt->setHardware();
        }
        emit saveAll();
        break;
    case W_CONF_EASY:
        break;
    case W_CONF_CULL:
        index = tabWidget->currentIndex();
        if (tabWidget->tabText(index) == tr("反嵌"))
            wOpp->startDebug();
        if (tabWidget->tabText(index) == tr("匝间"))
            wItt->startDebug();
        break;
    default:
        break;
    }
}
int main(void) {
	app_message_register_inbox_received(received_data);
	app_message_register_outbox_sent(data_sent);
	app_message_open(124, 50);

  
	inverter_layer = inverter_layer_create(GRect(0, 0, 144, 168));
	switchWindow(0);

	app_timer_register(300, timerTriggered, NULL);

	app_event_loop();

  inverter_layer_destroy(inverter_layer);
	window_stack_pop_all(false);
	return 0;
}
예제 #11
0
static void menu_select_callback(MenuLayer *me, MenuIndex *cell_index, void *data)
{
	DictionaryIterator *iterator;
	app_message_outbox_begin(&iterator);

	int16_t index = cell_index->row;

	dict_write_uint8(iterator, 0, 0);
	dict_write_uint8(iterator, 1, 1);
	dict_write_uint8(iterator, 2, index);

	app_message_outbox_send();

	int newWindow = index > 0 ? 3 : 2;
	switchWindow(newWindow);
	if (index > 1 && config_noFilterGroups)
		contacts_window_stop_filtering();
}
예제 #12
0
void menu_picked(int index, void* context)
{
	DictionaryIterator *iterator;
	app_message_outbox_begin(&iterator);

	dict_write_uint8(iterator, 0, 2);
	dict_write_uint8(iterator, 1, index);

	app_message_outbox_send();

	app_comm_set_sniff_interval(SNIFF_INTERVAL_REDUCED);
	app_comm_set_sniff_interval(SNIFF_INTERVAL_NORMAL);

	int newWindow = index > 0 ? 1 : 4;
	if (index > 1 && skipGroupFiltering)
		newWindow = 2;
	switchWindow(newWindow);
}
int main(void) {
	app_message_register_inbox_received(received_data);
	app_message_register_outbox_sent(data_sent);
	app_message_open(124, 50);

	switchWindow(0);

	DictionaryIterator *iterator;
	app_message_outbox_begin(&iterator);
	dict_write_uint8(iterator, 0, 0);
	app_message_outbox_send();

	app_comm_set_sniff_interval(SNIFF_INTERVAL_REDUCED);
	app_comm_set_sniff_interval(SNIFF_INTERVAL_NORMAL);

	app_event_loop();

	window_stack_pop_all(false);
	return 0;
}
예제 #14
0
RenderManager::RenderManager(ApplicationContext &applicationContext, Window *window)
    : m_applicationContext(applicationContext) {
    
    if (!this->initWindow()) {
        printf("Failed to initialize window!\n");
        exit(1); // TODO replace with exceptions
    } else if (!this->initGL()) {
        printf("Unable to initialize OpenGL!\n");
        exit(1);
    } else if (!this->initRenders()) {
        printf("Unable to initialize window renders!\n");
        exit(1);
    } else {
#ifdef DEF_ANDROID
        initBindings();
#endif // DEF_ANDROID
    }

    switchWindow(*window);
}
void received_data(DictionaryIterator *received, void *context) {
	gotNotification = true;

	uint8_t packetId = dict_find(received, 0)->value->uint8;
	if(packetId == 3){
	  //Retrieve isNotificationListenerSupported;
	  isNotificationListenerSupported = dict_find(received, 3)->value->uint8;
	}
 
  if ((packetId == 3) || (packetId == 10))
	{
		//Retrieve options when loading main menu or when they are changed
		options_data_received(received);
	}
 
	if (packetId == 0 && curWindow > 1)
	{
		switchWindow(1);
	}
	
	switch (curWindow)
	{
	case 0:
		menu_data_received(packetId, received);
		break;
	case 1:
		notification_received_data(packetId, received);
		break;
	case 2:
		list_data_received(packetId, received);
		break;
	}
	

	app_comm_set_sniff_interval(SNIFF_INTERVAL_REDUCED);
	app_comm_set_sniff_interval(SNIFF_INTERVAL_NORMAL);
}
예제 #16
0
파일: w_colr.cpp 프로젝트: link8001/aip
/******************************************************************************
  * version:    1.0
  * author:     link
  * date:       2016.01.20
  * brief:      点击按钮,发送颜色信息
******************************************************************************/
void w_Colr::buttonJudge(int id)
{
    emit switchColor(id);
    emit switchWindow(W_CONF);
}
예제 #17
0
static void received_data(DictionaryIterator *received, void *context) {
	app_comm_set_sniff_interval(SNIFF_INTERVAL_REDUCED);

	uint8_t destModule = dict_find(received, 0)->value->uint8;
	uint8_t packetId = dict_find(received, 1)->value->uint8;
	bool autoSwitch = dict_find(received, 999) != NULL;

	if (destModule == 0 && packetId == 0)
	{
		received_config(received);
		return;
	}

	if (!gotConfig) //Do not react to anything until we got config
		return;

	if (destModule == 0)
	{
		if (packetId == 1)
		{
			closingMode = true;
			window_stack_pop_all(false);
			switchWindow(0);

			return;
		}
		if (curWindow != 0)
		{
			if (autoSwitch)
				switchWindow(0);
			else
				return;
		}

		main_menu_data_received(packetId, received);
	}
	else if (destModule == 1)
	{
		if (curWindow != 1)
		{
			if (autoSwitch)
				switchWindow(1);
			else
				return;
		}

		call_window_data_received(destModule, packetId, received);
	}
	else if (destModule == 2)
	{
		if (curWindow != 2)
		{
			if (autoSwitch)
				switchWindow(2);
			else
				return;
		}

		call_log_window_data_received(packetId, received);
	}
	else if (destModule == 3)
	{
		if (curWindow != 3)
		{
			if (autoSwitch)
				switchWindow(3);
			else
				return;
		}

		contacts_window_data_received(packetId, received);
	}
	else if (destModule == 4)
	{
		if (curWindow != 4)
		{
			if (autoSwitch)
				switchWindow(4);
			else
				return;
		}

		number_picker_window_data_received(packetId, received);
	}
	else if (destModule == 5)
	{
		actions_menu_got_data(packetId, received);
	}
}