Home | History | Annotate | Download | only in server
      1 /* Copyright (c) 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_BT_PLAYER_H_
      7 #define CRAS_BT_PLAYER_H_
      8 
      9 #include <dbus/dbus.h>
     10 #include <stdbool.h>
     11 
     12 #include "cras_bt_adapter.h"
     13 
     14 
     15 /* Object to register as media player so that bluetoothd will report hardware
     16  * volume from device through bt_transport. Properties of the player are defined
     17  * in BlueZ's media API.
     18  */
     19 struct cras_bt_player {
     20 	const char *object_path;
     21 	const char *playback_status;
     22 	const char *identity;
     23 	const char *loop_status;
     24 	int position;
     25 	bool can_go_next;
     26 	bool can_go_prev;
     27 	bool can_play;
     28 	bool can_pause;
     29 	bool can_control;
     30 	bool shuffle;
     31 	void (*message_cb)(const char *message);
     32 };
     33 
     34 /* Creates a player object and register it to bluetoothd.
     35  * Args:
     36  *    conn - The dbus connection.
     37  */
     38 int cras_bt_player_create(DBusConnection *conn);
     39 
     40 /* Registers created player to bluetoothd. This is used when an bluetooth
     41  * adapter got enumerated.
     42  * Args:
     43  *    conn - The dbus connection.
     44  *    adapter - The enumerated bluetooth adapter.
     45  */
     46 int cras_bt_register_player(DBusConnection *conn,
     47 			    const struct cras_bt_adapter *adapter);
     48 
     49 #endif /* CRAS_BT_PLAYER_H_ */