Home | History | Annotate | Download | only in android

Lines Matching defs:cl

188 _hwSensorClient_free( HwSensorClient*  cl )
191 if (cl->sensors) {
192 HwSensorClient** pnode = &cl->sensors->clients;
197 if (node == cl) {
198 *pnode = cl->next;
203 cl->next = NULL;
204 cl->sensors = NULL;
208 if (cl->client) {
209 qemud_client_close(cl->client);
210 cl->client = NULL;
213 if (cl->timer) {
214 timer_del(cl->timer);
215 timer_free(cl->timer);
216 cl->timer = NULL;
218 AFREE(cl);
228 HwSensorClient* cl;
230 ANEW0(cl);
232 cl->sensors = sensors;
233 cl->enabledMask = 0;
234 cl->delay_ms = 800;
235 cl->timer = timer_new(QEMU_CLOCK_VIRTUAL, SCALE_NS, _hwSensorClient_tick, cl);
237 cl->next = sensors->clients;
238 sensors->clients = cl;
240 return cl;
245 static void _hwSensorClient_receive( HwSensorClient* cl,
255 HwSensorClient* cl = opaque;
257 _hwSensorClient_receive(cl, msg, msglen);
263 HwSensorClient* cl = opaque;
266 cl->client = NULL;
267 _hwSensorClient_free(cl);
272 _hwSensorClient_send( HwSensorClient* cl, const uint8_t* msg, int msglen )
275 qemud_client_send(cl->client, msg, msglen);
279 _hwSensorClient_enabled( HwSensorClient* cl, int sensorId )
281 return (cl->enabledMask & (1 << sensorId)) != 0;
290 HwSensorClient* cl = opaque;
291 HwSensors* hw = cl->sensors;
292 int64_t delay = cl->delay_ms;
294 uint32_t mask = cl->enabledMask;
298 if (_hwSensorClient_enabled(cl, ANDROID_SENSOR_ACCELERATION)) {
304 _hwSensorClient_send(cl, (uint8_t*)buffer, strlen(buffer));
307 if (_hwSensorClient_enabled(cl, ANDROID_SENSOR_MAGNETIC_FIELD)) {
314 _hwSensorClient_send(cl, (uint8_t*)buffer, strlen(buffer));
317 if (_hwSensorClient_enabled(cl, ANDROID_SENSOR_ORIENTATION)) {
323 _hwSensorClient_send(cl, (uint8_t*)buffer, strlen(buffer));
326 if (_hwSensorClient_enabled(cl, ANDROID_SENSOR_TEMPERATURE)) {
330 _hwSensorClient_send(cl, (uint8_t*)buffer, strlen(buffer));
333 if (_hwSensorClient_enabled(cl, ANDROID_SENSOR_PROXIMITY)) {
337 _hwSensorClient_send(cl, (uint8_t*) buffer, strlen(buffer));
343 _hwSensorClient_send(cl, (uint8_t*)buffer, strlen(buffer));
355 timer_mod(cl->timer, now_ns + delay);
360 _hwSensorClient_receive( HwSensorClient* cl, uint8_t* msg, int msglen )
362 HwSensors* hw = cl->sensors;
381 _hwSensorClient_send(cl, (const uint8_t*)buff, strlen(buff));
389 _hwSensorClient_send(cl, (const uint8_t*)"wake", 4);
397 cl->delay_ms = atoi((const char*)msg+10);
398 if (cl->enabledMask != 0)
399 _hwSensorClient_tick(cl);
409 int id, enabled, oldEnabledMask = cl->enabledMask;
431 cl->enabledMask |= (1 << id);
433 cl->enabledMask &= ~(1 << id);
435 if (cl->enabledMask != oldEnabledMask) {
437 (cl->enabledMask & (1 << id)) ? "enabling" : "disabling", msg);
449 _hwSensorClient_tick(cl);
487 HwSensorClient* cl = _hwSensorClient_new(sensors);
488 QemudClient* client = qemud_client_new(service, channel, client_param, cl,
494 cl->client = client;