示例#1
0
int main_event_handler_init(xloop_t *l)
{
	loop = l;

	cfw_handle = cfw_client_init(loop->queue, cfw_message_handler, NULL);

	cfw_open_service_helper(cfw_handle, SOC_GPIO_SERVICE_ID,
				service_opened_cb, (void *)SOC_GPIO_SERVICE_ID);

	cfw_open_service_helper(cfw_handle, SS_ADC_SERVICE_ID,
				service_opened_cb, (void *)SS_ADC_SERVICE_ID);

	xloop_post_func_periodic(loop, hello_func, NULL, NOTIF_DELAY_MS);
	pr_debug(LOG_MODULE_MAIN, "main event handler initialized");
	return 0;
}
示例#2
0
void sensordata_init(T_QUEUE queue)
{
	/* Initialize client message handler */
	cfw_client_t *sensor_client = cfw_client_init(queue, sensor_handle_msg,
						      NULL);

	/* Open the sensor service */
	cfw_open_service_helper(sensor_client, ARC_SC_SVC_ID,
				service_connection_cb, NULL);
}
示例#3
0
void sensing_iq_init(T_QUEUE queue)
{
	static bool sensing_initialized = false;

	if (!sensing_initialized){
		sensor_client = cfw_client_init(queue, sensor_handle_msg, NULL);

		cfw_open_service_helper(sensor_client, ARC_SC_SVC_ID,
				sensing_start_sensor_scanning, NULL);
		sensing_initialized = true;
	}
}
示例#4
0
文件: ble_app.c 项目: SDICurie/main
void ble_start_app(T_QUEUE queue)
{
	cfw_client_t *client;

	/* Get a client handle */
	client = cfw_client_init(queue, ble_app_msg_handler, &_ble_app_cb);
	assert(client);

	/* Open properties service -> will resume app initialization */
	cfw_open_service_helper(client, PROPERTIES_SERVICE_ID,
				on_properties_service_open, client);
}
示例#5
0
文件: ble_app.c 项目: SDICurie/main
static void on_properties_service_open(cfw_service_conn_t *p_conn, void *param)
{
	/* The client reference was passed as parameter */
	cfw_client_t *client = param;

	/* Check if the properties connection is already initialized */
	if (_ble_app_cb.p_props_conn) {
		pr_warning(LOG_MODULE_BLE, "ble_app: properties twice?");
		return;
	}
	_ble_app_cb.p_props_conn = p_conn;

	/* start BLE app when BLE_SERVICE is available */
	cfw_open_service_helper(client, BLE_SERVICE_ID,
				on_ble_service_open, &_ble_app_cb);

#ifdef CONFIG_BLE_APP_USE_BAT
	/* add the battery service helper from the beginning */
	cfw_open_service_helper(client, BATTERY_SERVICE_ID,
				on_batt_service_open, &_ble_app_cb);
#endif
}