1 /* Copyright 2016 The Chromium OS Authors. All rights reserved. 2 * Use of this source code is governed by a BSD-style license that can be 3 * found in the LICENSE file. 4 */ 5 6 #ifndef CRAS_OBSERVER_OPS_H 7 #define CRAS_OBSERVER_OPS_H 8 9 #include "cras_types.h" 10 11 /* Observation of CRAS state. 12 * Unless otherwise specified, all notifications only contain the data value 13 * reflecting the current state: it is possible that multiple notifications 14 * are queued within CRAS before being sent to the client. 15 */ 16 struct cras_observer_ops { 17 /* System output volume changed. */ 18 void (*output_volume_changed)(void *context, int32_t volume); 19 /* System output mute changed. */ 20 void (*output_mute_changed)(void *context, int muted, int user_muted, 21 int mute_locked); 22 /* System input/capture gain changed. */ 23 void (*capture_gain_changed)(void *context, int32_t gain); 24 /* System input/capture mute changed. */ 25 void (*capture_mute_changed)(void *context, int muted, int mute_locked); 26 /* Device or node topology changed. */ 27 void (*nodes_changed)(void *context); 28 /* Active node changed. A notification is sent for every change. 29 * When there is no active node, node_id is 0. */ 30 void (*active_node_changed)(void *context, 31 enum CRAS_STREAM_DIRECTION dir, 32 cras_node_id_t node_id); 33 /* Output node volume changed. */ 34 void (*output_node_volume_changed)(void *context, 35 cras_node_id_t node_id, 36 int32_t volume); 37 /* Node left/right swapped state change. */ 38 void (*node_left_right_swapped_changed)(void *context, 39 cras_node_id_t node_id, 40 int swapped); 41 /* Input gain changed. */ 42 void (*input_node_gain_changed)(void *context, cras_node_id_t node_id, 43 int32_t gain); 44 /* Suspend state changed. */ 45 void (*suspend_changed)(void *context, int suspended); 46 /* Number of active streams changed. */ 47 void (*num_active_streams_changed)(void *context, 48 enum CRAS_STREAM_DIRECTION dir, 49 uint32_t num_active_streams); 50 /* Number of input streams with permission changed. */ 51 void (*num_input_streams_with_permission_changed)( 52 void *context, 53 uint32_t num_input_streams[CRAS_NUM_CLIENT_TYPE]); 54 /* Hotword triggered. */ 55 void (*hotword_triggered)(void *context, int64_t tv_sec, 56 int64_t tv_nsec); 57 /* State regarding whether non-empty audio is being played/captured has 58 * changed. */ 59 void (*non_empty_audio_state_changed)(void *context, int non_empty); 60 /* Bluetooth headset battery level changed. */ 61 void (*bt_battery_changed)(void *context, const char *address, 62 uint32_t level); 63 }; 64 65 #endif /* CRAS_OBSERVER_OPS_H */ 66