Lines Matching refs:stdev

203         struct stub_sound_trigger_device* stdev, sound_model_handle_t* model_handle) {  in fetch_model_with_handle()  argument
206 struct recognition_context *last_model_context = stdev->root_model_context; in fetch_model_with_handle()
218 static sound_model_handle_t* get_model_handle_with_uuid(struct stub_sound_trigger_device* stdev, in get_model_handle_with_uuid() argument
221 struct recognition_context *last_model_context = stdev->root_model_context; in get_model_handle_with_uuid()
234 struct stub_sound_trigger_device *stdev = (struct stub_sound_trigger_device *)dev; in generate_sound_model_handle() local
235 int new_id = stdev->next_sound_model_id; in generate_sound_model_handle()
236 ++stdev->next_sound_model_id; in generate_sound_model_handle()
237 if (stdev->next_sound_model_id == 0) { in generate_sound_model_handle()
238 stdev->next_sound_model_id = 1; in generate_sound_model_handle()
243 bool parse_socket_data(int conn_socket, struct stub_sound_trigger_device* stdev);
244 static void unload_all_sound_models(struct stub_sound_trigger_device *stdev);
308 struct stub_sound_trigger_device* stdev, int event_type, in send_event_with_handle() argument
311 struct recognition_context *model_context = fetch_model_with_handle(stdev, model_handle_str); in send_event_with_handle()
362 static void send_event(int conn_socket, struct stub_sound_trigger_device* stdev, int event_type, in send_event() argument
367 sound_model_handle_t* model_handle_str = get_model_handle_with_uuid(stdev, model_uuid); in send_event()
373 send_event_with_handle(model_handle_str, stdev, event_type, status); in send_event()
380 static bool recognition_callback_exists(struct stub_sound_trigger_device *stdev) { in recognition_callback_exists() argument
382 if (stdev->root_model_context) { in recognition_callback_exists()
383 struct recognition_context *current_model_context = stdev->root_model_context; in recognition_callback_exists()
395 static struct recognition_context * get_model_context(struct stub_sound_trigger_device *stdev, in get_model_context() argument
398 if (stdev->root_model_context) { in get_model_context()
399 struct recognition_context *current_model_context = stdev->root_model_context; in get_model_context()
412 struct stub_sound_trigger_device *stdev = (struct stub_sound_trigger_device *)context; in control_thread_loop() local
460 if (!parse_socket_data(con_socket, stdev)) { in control_thread_loop()
474 struct stub_sound_trigger_device* stdev) { in list_models() argument
476 struct recognition_context *last_model_context = stdev->root_model_context; in list_models()
529 bool parse_socket_data(int conn_socket, struct stub_sound_trigger_device* stdev) { in parse_socket_data() argument
541 pthread_mutex_lock(&stdev->lock); in parse_socket_data()
546 list_models(conn_socket, buffer, stdev); in parse_socket_data()
548 send_event(conn_socket, stdev, EVENT_RECOGNITION, RECOGNITION_STATUS_SUCCESS); in parse_socket_data()
550 send_event(conn_socket, stdev, EVENT_RECOGNITION, RECOGNITION_STATUS_ABORT); in parse_socket_data()
552 send_event(conn_socket, stdev, EVENT_RECOGNITION, RECOGNITION_STATUS_FAILURE); in parse_socket_data()
554 send_event(conn_socket, stdev, EVENT_SOUND_MODEL, SOUND_MODEL_STATUS_UPDATED); in parse_socket_data()
556 unload_all_sound_models(stdev); in parse_socket_data()
569 pthread_mutex_unlock(&stdev->lock); in parse_socket_data()
598 struct stub_sound_trigger_device *stdev = (struct stub_sound_trigger_device *)dev; in stdev_get_properties() local
612 struct stub_sound_trigger_device *stdev = (struct stub_sound_trigger_device *)dev; in stdev_load_sound_model() local
613 ALOGI("%s stdev %p", __func__, stdev); in stdev_load_sound_model()
615 pthread_mutex_lock(&stdev->lock); in stdev_load_sound_model()
618 pthread_mutex_unlock(&stdev->lock); in stdev_load_sound_model()
623 pthread_mutex_unlock(&stdev->lock); in stdev_load_sound_model()
631 pthread_mutex_unlock(&stdev->lock); in stdev_load_sound_model()
636 if (stdev->root_model_context) { in stdev_load_sound_model()
638 struct recognition_context *current_model_context = stdev->root_model_context; in stdev_load_sound_model()
646 pthread_mutex_unlock(&stdev->lock); in stdev_load_sound_model()
652 stdev->root_model_context = model_context; in stdev_load_sound_model()
672 pthread_mutex_unlock(&stdev->lock); in stdev_load_sound_model()
676 static void unload_all_sound_models(struct stub_sound_trigger_device *stdev) { in unload_all_sound_models() argument
678 struct recognition_context *model_context = stdev->root_model_context; in unload_all_sound_models()
679 stdev->root_model_context = NULL; in unload_all_sound_models()
680 pthread_mutex_lock(&stdev->lock); in unload_all_sound_models()
688 pthread_mutex_unlock(&stdev->lock); in unload_all_sound_models()
695 struct stub_sound_trigger_device *stdev = (struct stub_sound_trigger_device *)dev; in stdev_unload_sound_model() local
698 pthread_mutex_lock(&stdev->lock); in stdev_unload_sound_model()
702 if (stdev->root_model_context) { in stdev_unload_sound_model()
703 struct recognition_context *current_model_context = stdev->root_model_context; in stdev_unload_sound_model()
715 pthread_mutex_unlock(&stdev->lock); in stdev_unload_sound_model()
721 stdev->root_model_context = model_context->next; in stdev_unload_sound_model()
725 pthread_mutex_unlock(&stdev->lock); in stdev_unload_sound_model()
735 struct stub_sound_trigger_device *stdev = (struct stub_sound_trigger_device *)dev; in stdev_start_recognition() local
736 pthread_mutex_lock(&stdev->lock); in stdev_start_recognition()
739 bool other_callbacks_found = recognition_callback_exists(stdev); in stdev_start_recognition()
741 struct recognition_context *model_context = get_model_context(stdev, handle); in stdev_start_recognition()
744 pthread_mutex_unlock(&stdev->lock); in stdev_start_recognition()
753 pthread_mutex_unlock(&stdev->lock); in stdev_start_recognition()
762 pthread_mutex_unlock(&stdev->lock); in stdev_start_recognition()
769 struct stub_sound_trigger_device *stdev = (struct stub_sound_trigger_device *)dev; in stdev_stop_recognition() local
771 pthread_mutex_lock(&stdev->lock); in stdev_stop_recognition()
773 struct recognition_context *model_context = get_model_context(stdev, handle); in stdev_stop_recognition()
776 pthread_mutex_unlock(&stdev->lock); in stdev_stop_recognition()
786 pthread_mutex_unlock(&stdev->lock); in stdev_stop_recognition()
793 struct stub_sound_trigger_device *stdev = (struct stub_sound_trigger_device *)dev; in stdev_stop_all_recognitions() local
795 pthread_mutex_lock(&stdev->lock); in stdev_stop_all_recognitions()
797 struct recognition_context *model_context = stdev->root_model_context; in stdev_stop_all_recognitions()
809 pthread_mutex_unlock(&stdev->lock); in stdev_stop_all_recognitions()
817 struct stub_sound_trigger_device *stdev = (struct stub_sound_trigger_device *)dev; in stdev_get_model_state() local
819 pthread_mutex_lock(&stdev->lock); in stdev_get_model_state()
821 struct recognition_context *model_context = get_model_context(stdev, handle); in stdev_get_model_state()
843 pthread_mutex_unlock(&stdev->lock); in stdev_get_model_state()
878 struct stub_sound_trigger_device *stdev; in stdev_open() local
884 stdev = calloc(1, sizeof(struct stub_sound_trigger_device)); in stdev_open()
885 if (!stdev) in stdev_open()
888 stdev->next_sound_model_id = 1; in stdev_open()
889 stdev->root_model_context = NULL; in stdev_open()
891 stdev->device.common.tag = HARDWARE_DEVICE_TAG; in stdev_open()
892 stdev->device.common.version = SOUND_TRIGGER_DEVICE_API_VERSION_1_1; in stdev_open()
893 stdev->device.common.module = (struct hw_module_t *) module; in stdev_open()
894 stdev->device.common.close = stdev_close; in stdev_open()
895 stdev->device.get_properties = stdev_get_properties; in stdev_open()
896 stdev->device.load_sound_model = stdev_load_sound_model; in stdev_open()
897 stdev->device.unload_sound_model = stdev_unload_sound_model; in stdev_open()
898 stdev->device.start_recognition = stdev_start_recognition; in stdev_open()
899 stdev->device.stop_recognition = stdev_stop_recognition; in stdev_open()
900 stdev->device.stop_all_recognitions = stdev_stop_all_recognitions; in stdev_open()
901 stdev->device.get_model_state = stdev_get_model_state; in stdev_open()
903 pthread_mutex_init(&stdev->lock, (const pthread_mutexattr_t *) NULL); in stdev_open()
905 *device = &stdev->device.common; in stdev_open()
907 pthread_create(&stdev->control_thread, (const pthread_attr_t *) NULL, in stdev_open()
908 control_thread_loop, stdev); in stdev_open()