Home | History | Annotate | Download | only in soundtrigger

Lines Matching defs:stdev

204         struct stub_sound_trigger_device* stdev, sound_model_handle_t* model_handle) {
207 struct recognition_context *last_model_context = stdev->root_model_context;
219 static sound_model_handle_t* get_model_handle_with_uuid(struct stub_sound_trigger_device* stdev,
222 struct recognition_context *last_model_context = stdev->root_model_context;
235 struct stub_sound_trigger_device *stdev = (struct stub_sound_trigger_device *)dev;
236 int new_id = stdev->next_sound_model_id;
237 ++stdev->next_sound_model_id;
238 if (stdev->next_sound_model_id == 0) {
239 stdev->next_sound_model_id = 1;
244 bool parse_socket_data(int conn_socket, struct stub_sound_trigger_device* stdev);
245 static void unload_all_sound_models(struct stub_sound_trigger_device *stdev);
309 struct stub_sound_trigger_device* stdev, int event_type,
312 struct recognition_context *model_context = fetch_model_with_handle(stdev, model_handle_str);
363 static void send_event(int conn_socket, struct stub_sound_trigger_device* stdev, int event_type,
368 sound_model_handle_t* model_handle_str = get_model_handle_with_uuid(stdev, model_uuid);
374 send_event_with_handle(model_handle_str, stdev, event_type, status);
381 static bool recognition_callback_exists(struct stub_sound_trigger_device *stdev) {
383 if (stdev->root_model_context) {
384 struct recognition_context *current_model_context = stdev->root_model_context;
396 static struct recognition_context * get_model_context(struct stub_sound_trigger_device *stdev,
399 if (stdev->root_model_context) {
400 struct recognition_context *current_model_context = stdev->root_model_context;
413 struct stub_sound_trigger_device *stdev = (struct stub_sound_trigger_device *)context;
461 if (!parse_socket_data(con_socket, stdev)) {
475 struct stub_sound_trigger_device* stdev) {
477 struct recognition_context *last_model_context = stdev->root_model_context;
530 bool parse_socket_data(int conn_socket, struct stub_sound_trigger_device* stdev) {
542 pthread_mutex_lock(&stdev->lock);
547 list_models(conn_socket, buffer, stdev);
549 send_event(conn_socket, stdev, EVENT_RECOGNITION, RECOGNITION_STATUS_SUCCESS);
551 send_event(conn_socket, stdev, EVENT_RECOGNITION, RECOGNITION_STATUS_ABORT);
553 send_event(conn_socket, stdev, EVENT_RECOGNITION, RECOGNITION_STATUS_FAILURE);
555 send_event(conn_socket, stdev, EVENT_SOUND_MODEL, SOUND_MODEL_STATUS_UPDATED);
557 unload_all_sound_models(stdev);
570 pthread_mutex_unlock(&stdev->lock);
599 struct stub_sound_trigger_device *stdev = (struct stub_sound_trigger_device *)dev;
613 struct stub_sound_trigger_device *stdev = (struct stub_sound_trigger_device *)dev;
614 ALOGI("%s stdev %p", __func__, stdev);
616 pthread_mutex_lock(&stdev->lock);
619 pthread_mutex_unlock(&stdev->lock);
624 pthread_mutex_unlock(&stdev->lock);
632 pthread_mutex_unlock(&stdev->lock);
637 if (stdev->root_model_context) {
639 struct recognition_context *current_model_context = stdev->root_model_context;
647 pthread_mutex_unlock(&stdev->lock);
653 stdev->root_model_context = model_context;
673 pthread_mutex_unlock(&stdev->lock);
677 static void unload_all_sound_models(struct stub_sound_trigger_device *stdev) {
679 struct recognition_context *model_context = stdev->root_model_context;
680 stdev->root_model_context = NULL;
681 pthread_mutex_lock(&stdev->lock);
689 pthread_mutex_unlock(&stdev->lock);
696 struct stub_sound_trigger_device *stdev = (struct stub_sound_trigger_device *)dev;
699 pthread_mutex_lock(&stdev->lock);
703 if (stdev->root_model_context) {
704 struct recognition_context *current_model_context = stdev->root_model_context;
716 pthread_mutex_unlock(&stdev->lock);
722 stdev->root_model_context = model_context->next;
726 pthread_mutex_unlock(&stdev->lock);
736 struct stub_sound_trigger_device *stdev = (struct stub_sound_trigger_device *)dev;
737 pthread_mutex_lock(&stdev->lock);
740 bool other_callbacks_found = recognition_callback_exists(stdev);
742 struct recognition_context *model_context = get_model_context(stdev, handle);
745 pthread_mutex_unlock(&stdev->lock);
754 pthread_mutex_unlock(&stdev->lock);
763 pthread_mutex_unlock(&stdev->lock);
770 struct stub_sound_trigger_device *stdev = (struct stub_sound_trigger_device *)dev;
772 pthread_mutex_lock(&stdev->lock);
774 struct recognition_context *model_context = get_model_context(stdev, handle);
777 pthread_mutex_unlock(&stdev->lock);
787 pthread_mutex_unlock(&stdev->lock);
794 struct stub_sound_trigger_device *stdev = (struct stub_sound_trigger_device *)dev;
796 pthread_mutex_lock(&stdev->lock);
798 struct recognition_context *model_context = stdev->root_model_context;
810 pthread_mutex_unlock(&stdev->lock);
844 struct stub_sound_trigger_device *stdev;
850 stdev = calloc(1, sizeof(struct stub_sound_trigger_device));
851 if (!stdev)
854 stdev->next_sound_model_id = 1;
855 stdev->root_model_context = NULL;
857 stdev->device.common.tag = HARDWARE_DEVICE_TAG;
858 stdev->device.common.version = SOUND_TRIGGER_DEVICE_API_VERSION_1_1;
859 stdev->device.common.module = (struct hw_module_t *) module;
860 stdev->device.common.close = stdev_close;
861 stdev->device.get_properties = stdev_get_properties;
862 stdev->device.load_sound_model = stdev_load_sound_model;
863 stdev->device.unload_sound_model = stdev_unload_sound_model;
864 stdev->device.start_recognition = stdev_start_recognition;
865 stdev->device.stop_recognition = stdev_stop_recognition;
866 stdev->device.stop_all_recognitions = stdev_stop_all_recognitions;
868 pthread_mutex_init(&stdev->lock, (const pthread_mutexattr_t *) NULL);
870 *device = &stdev->device.common;
872 pthread_create(&stdev->control_thread, (const pthread_attr_t *) NULL,
873 control_thread_loop, stdev);