NUGU SDK Linux  1.7.6
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 #include <nugu.h>
22 
23 namespace NuguCapability {
24 
25 using namespace NuguClientKit;
26 
42 typedef struct _BTProfile {
43  std::string name;
44  bool enable;
46 
51 typedef struct _BTDeviceInfo {
52  std::string device_name;
53  bool power_on;
54  std::vector<BTProfile> profiles;
57  std::string active_device_id;
58  std::string active_device_name;
61 
66 class NUGU_API IBluetoothListener : virtual public ICapabilityListener {
67 public:
68  virtual ~IBluetoothListener() = default;
69 
74  virtual void startDiscoverableMode(long duration_sec) = 0;
75 
79  virtual void finishDiscoverableMode() = 0;
80 
85  virtual void play(bool by_focus = false) = 0;
86 
91  virtual void stop(bool by_focus = false) = 0;
92 
97  virtual void pause(bool by_focus = false) = 0;
98 
102  virtual void next() = 0;
103 
107  virtual void previous() = 0;
108 
113  virtual void requestContext(BTDeviceInfo& device_info) = 0;
114 };
115 
120 class NUGU_API IBluetoothHandler : virtual public ICapabilityInterface {
121 public:
122  virtual ~IBluetoothHandler() = default;
123 
128  virtual void setAudioPlayerState(const std::string& state) = 0;
129 
134  virtual void startDiscoverableModeSucceeded(bool has_paired_devices) = 0;
135 
140  virtual void startDiscoverableModeFailed(bool has_paired_devices) = 0;
141 
146 
150  virtual void finishDiscoverableModeFailed() = 0;
151 
155  virtual void connectSucceeded() = 0;
156 
160  virtual void connectFailed() = 0;
161 
165  virtual void disconnectSucceeded() = 0;
166 
170  virtual void disconnectFailed() = 0;
171 
175  virtual void mediaControlPlaySucceeded() = 0;
176 
180  virtual void mediaControlPlayFailed() = 0;
181 
185  virtual void mediaControlStopSucceeded() = 0;
186 
190  virtual void mediaControlStopFailed() = 0;
191 
195  virtual void mediaControlPauseSucceeded() = 0;
196 
200  virtual void mediaControlPauseFailed() = 0;
201 
205  virtual void mediaControlNextSucceeded() = 0;
206 
210  virtual void mediaControlNextFailed() = 0;
211 
215  virtual void mediaControlPreviousSucceeded() = 0;
216 
220  virtual void mediaControlPreviousFailed() = 0;
221 };
222 
227 } // NuguCapability
228 
229 #endif /* __NUGU_BLUETOOTH_INTERFACE_H__ */
bluetooth handler interface
Definition: bluetooth_interface.hh:120
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:66
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:82
capability listener interface
Definition: capability_interface.hh:60
struct NuguCapability::_BTDeviceInfo BTDeviceInfo
Bluetooth device information.
struct NuguCapability::_BTProfile BTProfile
Bluetooth profiles information.
Bluetooth device information.
Definition: bluetooth_interface.hh:51
bool power_on
Definition: bluetooth_interface.hh:53
std::string active_device_streaming
Definition: bluetooth_interface.hh:59
bool is_paired_device
Definition: bluetooth_interface.hh:55
std::vector< BTProfile > profiles
Definition: bluetooth_interface.hh:54
std::string active_device_name
Definition: bluetooth_interface.hh:58
std::string device_name
Definition: bluetooth_interface.hh:52
std::string active_device_id
Definition: bluetooth_interface.hh:57
bool is_active_device
Definition: bluetooth_interface.hh:56
Bluetooth profiles information.
Definition: bluetooth_interface.hh:42
bool enable
Definition: bluetooth_interface.hh:44
std::string name
Definition: bluetooth_interface.hh:43