Home | History | Annotate | Download | only in android

Lines Matching refs:asp

152 _sensors_port_discard_sensors(AndroidSensorsPort* asp)
154 if (asp->sensors != NULL) {
156 for (n = 0; n < asp->sensors_count; n++) {
157 if (asp->sensors[n] != NULL) {
158 free(asp->sensors[n]->sensor_name);
159 AFREE(asp->sensors[n]);
162 free(asp->sensors);
163 asp->sensors = NULL;
165 asp->sensors_count = 0;
171 _sensors_port_free(AndroidSensorsPort* asp)
173 if (asp != NULL) {
174 _sensors_port_discard_sensors(asp);
175 if (asp->sdkctl != NULL) {
176 sdkctl_socket_release(asp->sdkctl);
178 AFREE(asp);
185 _sensors_port_save_sensors(AndroidSensorsPort* asp, const SensorEntry* list)
191 asp->sensors = malloc(sizeof(SensorDescriptor*) * count);
208 asp->sensors[asp->sensors_count++] = desc;
217 D("Sensors: Emulating %d sensors", asp->sensors_count);
223 _sensor_from_sdkctl_id(AndroidSensorsPort* asp, int id)
226 for (n = 0; n < asp->sensors_count; n++) {
227 if (asp->sensors[n]->sensor_id == id) {
228 return asp->sensors[n];
236 * asp - Android sensors port instance returned from sensors_port_create.
241 _sensors_port_start(AndroidSensorsPort* asp)
245 if (!sdkctl_socket_is_port_ready(asp->sdkctl)) {
253 sensors_port_disable_sensor(asp, "all");
256 for (n = 0; n < asp->sensors_count; n++) {
257 if (android_sensors_get_sensor_status(asp->sensors[n]->emulator_id) == 1) {
259 sensors_port_enable_sensor(asp, asp->sensors[n]->sensor_name);
261 asp->sensors[n]->sensor_name);
267 sdkctl_message_send(asp->sdkctl, SDKCTL_SENSORS_START, NULL, 0);
283 AndroidSensorsPort* const asp = (AndroidSensorsPort*)(query_opaque);
295 _sensors_port_save_sensors(asp, list);
298 _sensors_port_start(asp);
305 * asp - AndroidSensorsPort instance.
309 _on_sensor_event(AndroidSensorsPort* asp, const SensorEvent* event)
313 _sensor_from_sdkctl_id(asp, event->sensor_id);
332 AndroidSensorsPort* const asp = (AndroidSensorsPort*)client_opaque;
337 _sensors_port_discard_sensors(asp);
354 AndroidSensorsPort* const asp = (AndroidSensorsPort*)client_opaque;
360 sdkctl_query_build_and_send(asp->sdkctl, SDKCTL_SENSORS_QUERY_LIST,
362 _on_sensor_list_query, asp,
369 _sensors_port_discard_sensors(asp);
374 _sensors_port_start(asp);
417 AndroidSensorsPort* const asp = (AndroidSensorsPort*)client_opaque;
420 _on_sensor_event(asp, (const SensorEvent*)msg_data);
436 AndroidSensorsPort* asp;
438 ANEW0(asp);
439 asp->opaque = opaque;
440 asp->sensors = NULL;
441 asp->sensors_count = 0;
442 asp->sdkctl = sdkctl_socket_new(SDKCTL_SENSORS_TIMEOUT, "sensors",
445 _on_sensors_message, asp);
446 sdkctl_init_recycler(asp->sdkctl, 76, 8);
447 sdkctl_socket_connect(asp->sdkctl, SDKCTL_DEFAULT_TCP_PORT,
449 return asp;
453 sensors_port_destroy(AndroidSensorsPort* asp)
455 if (asp->sdkctl != NULL) {
456 sdkctl_socket_disconnect(asp->sdkctl);
458 _sensors_port_free(asp);
462 sensors_port_enable_sensor(AndroidSensorsPort* asp, const char* name)
464 if (asp->sdkctl != NULL && sdkctl_socket_is_port_ready(asp->sdkctl)) {
465 SDKCtlMessage* const msg = sdkctl_message_send(asp->sdkctl,
476 sensors_port_disable_sensor(AndroidSensorsPort* asp, const char* name)
478 if (asp->sdkctl != NULL && sdkctl_socket_is_port_ready(asp->sdkctl)) {
479 SDKCtlMessage* const msg = sdkctl_message_send(asp->sdkctl,