Beispiel #1
0
PUBLIC BOOL ui_render(Graphic *g) {
	void *iterator = linked_list_iterator(ui.linked_view, LINKED_LIST_TAIL);
	while (NULL != iterator) {
		View *view = linked_list_iterator_prev(&iterator);
		if (TRUE == view->isShowing)
			view_onDraw(view, NULL, g);
	}
	return TRUE;
}
Beispiel #2
0
PRIVATE BOOL _ui_doEvent(MOTION_ACTION action, int x, int y, Ui_Manager *ui) {
	/* do input events */
	void *iterator = linked_list_iterator(ui->linked_view, LINKED_LIST_HEAD);
	while (NULL != iterator) {
		View *view = linked_list_iterator_next(&iterator);
		if (TRUE == view->isShowing && TRUE == view_onEvent(view, NULL, action, x, y)) {
			/* LOGI("_ui_doEvent(): view: '%s' got the events", view->name); */
			return TRUE;
		}
	}
	return FALSE;
}
Beispiel #3
0
void* iotx_cm_ota_init(iotx_cm_conntext_t* cm_ctx, const char* version)
{
    linked_list_t* list;
    void* h_ota = NULL;
    iotx_device_info_t* device_info = iotx_device_info_get();
    iotx_connection_t* connection = NULL;

    connection = (iotx_connection_t*)cm_ctx->target_connectivity->context;

    if (NULL == cm_ctx || NULL == version) {
        CM_ERR(cm_log_error_parameter);
        return NULL;
    }

    list = cm_ctx->list_connectivity;

    cm_ctx->target_connectivity = NULL;
    linked_list_iterator(list, cm_find_ota_connectivity_handler, cm_ctx, IOTX_CM_CONNECTIVITY_TYPE_CLOUD);

    if (cm_ctx->target_connectivity) {
        h_ota = IOT_OTA_Init(device_info->product_key, device_info->device_name, connection->context);
        if (NULL == h_ota) {
            CM_ERR(cm_log_error_fail);
            return NULL;
        }
    } else {
        CM_WARNING(cm_log_warning_cloud_disconnected);
        return NULL;
    }

    cm_ctx->ota_handler = h_ota;

    if (0 != IOT_OTA_ReportVersion(h_ota, version)) {
        CM_ERR(cm_log_error_fail);
        IOT_OTA_Deinit(h_ota);
        return NULL;
    }

    iotx_ota_set_fetch_callback(h_ota, _fota_fetch, cm_ctx);
    iotx_ota_set_cota_fetch_callback(h_ota, _cota_fetch, cm_ctx);

    return h_ota;
}