NUGU SDK Linux  1.7.5
bluetooth_interface.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019 SK Telecom Co., Ltd. All rights reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef __NUGU_BLUETOOTH_INTERFACE_H__
18 #define __NUGU_BLUETOOTH_INTERFACE_H__
19 
21 
22 namespace NuguCapability {
23 
24 using namespace NuguClientKit;
25 
41 typedef struct _BTProfile {
42  std::string name;
43  bool enable;
45 
50 typedef struct _BTDeviceInfo {
51  std::string device_name;
52  bool power_on;
53  std::vector<BTProfile> profiles;
56  std::string active_device_id;
57  std::string active_device_name;
60 
65 class IBluetoothListener : virtual public ICapabilityListener {
66 public:
67  virtual ~IBluetoothListener() = default;
68 
73  virtual void startDiscoverableMode(long duration_sec) = 0;
74 
78  virtual void finishDiscoverableMode() = 0;
79 
84  virtual void play(bool by_focus = false) = 0;
85 
90  virtual void stop(bool by_focus = false) = 0;
91 
96  virtual void pause(bool by_focus = false) = 0;
97 
101  virtual void next() = 0;
102 
106  virtual void previous() = 0;
107 
112  virtual void requestContext(BTDeviceInfo& device_info) = 0;
113 };
114 
119 class IBluetoothHandler : virtual public ICapabilityInterface {
120 public:
121  virtual ~IBluetoothHandler() = default;
122 
127  virtual void setAudioPlayerState(const std::string& state) = 0;
128 
133  virtual void startDiscoverableModeSucceeded(bool has_paired_devices) = 0;
134 
139  virtual void startDiscoverableModeFailed(bool has_paired_devices) = 0;
140 
145 
149  virtual void finishDiscoverableModeFailed() = 0;
150 
154  virtual void connectSucceeded() = 0;
155 
159  virtual void connectFailed() = 0;
160 
164  virtual void disconnectSucceeded() = 0;
165 
169  virtual void disconnectFailed() = 0;
170 
174  virtual void mediaControlPlaySucceeded() = 0;
175 
179  virtual void mediaControlPlayFailed() = 0;
180 
184  virtual void mediaControlStopSucceeded() = 0;
185 
189  virtual void mediaControlStopFailed() = 0;
190 
194  virtual void mediaControlPauseSucceeded() = 0;
195 
199  virtual void mediaControlPauseFailed() = 0;
200 
204  virtual void mediaControlNextSucceeded() = 0;
205 
209  virtual void mediaControlNextFailed() = 0;
210 
214  virtual void mediaControlPreviousSucceeded() = 0;
215 
219  virtual void mediaControlPreviousFailed() = 0;
220 };
221 
226 } // NuguCapability
227 
228 #endif /* __NUGU_BLUETOOTH_INTERFACE_H__ */
bluetooth handler interface
Definition: bluetooth_interface.hh:119
virtual void mediaControlNextFailed()=0
Notify the fail result of playing next media.
virtual void finishDiscoverableModeSucceeded()=0
Notify the success result of finish discoverable mode.
virtual void connectFailed()=0
Notify the fail result of connect device.
virtual void mediaControlNextSucceeded()=0
Notify the success result of playing next media.
virtual void disconnectFailed()=0
Notify the fail result of disconnect device.
virtual void startDiscoverableModeSucceeded(bool has_paired_devices)=0
Notify the success result of start discoverable mode.
virtual void mediaControlPauseFailed()=0
Notify the fail result of pausing media.
virtual void connectSucceeded()=0
Notify the success result of connect device.
virtual void setAudioPlayerState(const std::string &state)=0
Notify the audio player's state.
virtual void mediaControlPreviousSucceeded()=0
Notify the success result of playing previous media.
virtual void startDiscoverableModeFailed(bool has_paired_devices)=0
Notify the fail result of start discoverable mode.
virtual void mediaControlPauseSucceeded()=0
Notify the success result of pausing media.
virtual void mediaControlStopSucceeded()=0
Notify the success result of stopping media.
virtual void mediaControlPlayFailed()=0
Notify the fail result of playing media.
virtual void mediaControlPreviousFailed()=0
Notify the fail result of playing previous media.
virtual void mediaControlPlaySucceeded()=0
Notify the success result of playing media.
virtual void finishDiscoverableModeFailed()=0
Notify the fail result of finish discoverable mode.
virtual void mediaControlStopFailed()=0
Notify the fail result of stopping media.
virtual void disconnectSucceeded()=0
Notify the success result of disconnect device.
bluetooth listener interface
Definition: bluetooth_interface.hh:65
virtual void play(bool by_focus=false)=0
Send command to play media to bluetooth adaptor.
virtual void startDiscoverableMode(long duration_sec)=0
Send command to switch discoverable on to bluetooth adaptor.
virtual void pause(bool by_focus=false)=0
Send command to pause media to bluetooth adaptor.
virtual void finishDiscoverableMode()=0
Send command to switch discoverable off to bluetooth adaptor.
virtual void requestContext(BTDeviceInfo &device_info)=0
Request device information for bluetooth context.
virtual void next()=0
Send command to play next media to bluetooth adaptor.
virtual void previous()=0
Send command to play previous media to bluetooth adaptor.
virtual void stop(bool by_focus=false)=0
Send command to stop media to bluetooth adaptor.
capability interface
Definition: capability_interface.hh:81
capability listener interface
Definition: capability_interface.hh:59
struct NuguCapability::_BTDeviceInfo BTDeviceInfo
Bluetooth device information.
struct NuguCapability::_BTProfile BTProfile
Bluetooth profiles information.
Bluetooth device information.
Definition: bluetooth_interface.hh:50
bool power_on
Definition: bluetooth_interface.hh:52
std::string active_device_streaming
Definition: bluetooth_interface.hh:58
bool is_paired_device
Definition: bluetooth_interface.hh:54
std::vector< BTProfile > profiles
Definition: bluetooth_interface.hh:53
std::string active_device_name
Definition: bluetooth_interface.hh:57
std::string device_name
Definition: bluetooth_interface.hh:51
std::string active_device_id
Definition: bluetooth_interface.hh:56
bool is_active_device
Definition: bluetooth_interface.hh:55
Bluetooth profiles information.
Definition: bluetooth_interface.hh:41
bool enable
Definition: bluetooth_interface.hh:43
std::string name
Definition: bluetooth_interface.hh:42