yocto_bluetoothlink.h
Go to the documentation of this file.
1 /*********************************************************************
2  *
3  * $Id: yocto_bluetoothlink.h 28748 2017-10-03 08:23:39Z seb $
4  *
5  * Declares yFindBluetoothLink(), the high-level API for BluetoothLink functions
6  *
7  * - - - - - - - - - License information: - - - - - - - - -
8  *
9  * Copyright (C) 2011 and beyond by Yoctopuce Sarl, Switzerland.
10  *
11  * Yoctopuce Sarl (hereafter Licensor) grants to you a perpetual
12  * non-exclusive license to use, modify, copy and integrate this
13  * file into your software for the sole purpose of interfacing
14  * with Yoctopuce products.
15  *
16  * You may reproduce and distribute copies of this file in
17  * source or object form, as long as the sole purpose of this
18  * code is to interface with Yoctopuce products. You must retain
19  * this notice in the distributed source file.
20  *
21  * You should refer to Yoctopuce General Terms and Conditions
22  * for additional information regarding your rights and
23  * obligations.
24  *
25  * THE SOFTWARE AND DOCUMENTATION ARE PROVIDED 'AS IS' WITHOUT
26  * WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING
27  * WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, FITNESS
28  * FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO
29  * EVENT SHALL LICENSOR BE LIABLE FOR ANY INCIDENTAL, SPECIAL,
30  * INDIRECT OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA,
31  * COST OF PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY OR
32  * SERVICES, ANY CLAIMS BY THIRD PARTIES (INCLUDING BUT NOT
33  * LIMITED TO ANY DEFENSE THEREOF), ANY CLAIMS FOR INDEMNITY OR
34  * CONTRIBUTION, OR OTHER SIMILAR COSTS, WHETHER ASSERTED ON THE
35  * BASIS OF CONTRACT, TORT (INCLUDING NEGLIGENCE), BREACH OF
36  * WARRANTY, OR OTHERWISE.
37  *
38  *********************************************************************/
39 
40 
41 #ifndef YOCTO_BLUETOOTHLINK_H
42 #define YOCTO_BLUETOOTHLINK_H
43 
44 #include "yocto_api.h"
45 #include <cfloat>
46 #include <cmath>
47 #include <map>
48 
49 //--- (YBluetoothLink return codes)
50 //--- (end of YBluetoothLink return codes)
51 //--- (YBluetoothLink definitions)
52 class YBluetoothLink; // forward declaration
53 
54 typedef void (*YBluetoothLinkValueCallback)(YBluetoothLink *func, const string& functionValue);
55 #ifndef _Y_MUTE_ENUM
56 #define _Y_MUTE_ENUM
57 typedef enum {
61 } Y_MUTE_enum;
62 #endif
63 #ifndef _Y_LINKSTATE_ENUM
64 #define _Y_LINKSTATE_ENUM
65 typedef enum {
74 #endif
75 #define Y_OWNADDRESS_INVALID (YAPI_INVALID_STRING)
76 #define Y_PAIRINGPIN_INVALID (YAPI_INVALID_STRING)
77 #define Y_REMOTEADDRESS_INVALID (YAPI_INVALID_STRING)
78 #define Y_REMOTENAME_INVALID (YAPI_INVALID_STRING)
79 #define Y_PREAMPLIFIER_INVALID (YAPI_INVALID_UINT)
80 #define Y_VOLUME_INVALID (YAPI_INVALID_UINT)
81 #define Y_LINKQUALITY_INVALID (YAPI_INVALID_UINT)
82 #define Y_COMMAND_INVALID (YAPI_INVALID_STRING)
83 //--- (end of YBluetoothLink definitions)
84 
85 //--- (YBluetoothLink declaration)
93 #ifdef __BORLANDC__
94 #pragma option push -w-8022
95 #endif
96 //--- (end of YBluetoothLink declaration)
97 protected:
98  //--- (YBluetoothLink attributes)
99  // Attributes (function value cache)
100  string _ownAddress;
101  string _pairingPin;
103  string _remoteName;
106  int _volume;
109  string _command;
111 
112  friend YBluetoothLink *yFindBluetoothLink(const string& func);
113  friend YBluetoothLink *yFirstBluetoothLink(void);
114 
115  // Function-specific method for parsing of JSON output and caching result
116  virtual int _parseAttr(YJSONObject* json_val);
117 
118  // Constructor is protected, use yFindBluetoothLink factory function to instantiate
119  YBluetoothLink(const string& func);
120  //--- (end of YBluetoothLink attributes)
121 
122 public:
123  ~YBluetoothLink();
124  //--- (YBluetoothLink accessors declaration)
125 
126  static const string OWNADDRESS_INVALID;
127  static const string PAIRINGPIN_INVALID;
128  static const string REMOTEADDRESS_INVALID;
129  static const string REMOTENAME_INVALID;
130  static const Y_MUTE_enum MUTE_FALSE = Y_MUTE_FALSE;
131  static const Y_MUTE_enum MUTE_TRUE = Y_MUTE_TRUE;
132  static const Y_MUTE_enum MUTE_INVALID = Y_MUTE_INVALID;
133  static const int PREAMPLIFIER_INVALID = YAPI_INVALID_UINT;
134  static const int VOLUME_INVALID = YAPI_INVALID_UINT;
135  static const Y_LINKSTATE_enum LINKSTATE_DOWN = Y_LINKSTATE_DOWN;
136  static const Y_LINKSTATE_enum LINKSTATE_FREE = Y_LINKSTATE_FREE;
137  static const Y_LINKSTATE_enum LINKSTATE_SEARCH = Y_LINKSTATE_SEARCH;
138  static const Y_LINKSTATE_enum LINKSTATE_EXISTS = Y_LINKSTATE_EXISTS;
139  static const Y_LINKSTATE_enum LINKSTATE_LINKED = Y_LINKSTATE_LINKED;
140  static const Y_LINKSTATE_enum LINKSTATE_PLAY = Y_LINKSTATE_PLAY;
141  static const Y_LINKSTATE_enum LINKSTATE_INVALID = Y_LINKSTATE_INVALID;
142  static const int LINKQUALITY_INVALID = YAPI_INVALID_UINT;
143  static const string COMMAND_INVALID;
144 
153  string get_ownAddress(void);
154 
155  inline string ownAddress(void)
156  { return this->get_ownAddress(); }
157 
169  string get_pairingPin(void);
170 
171  inline string pairingPin(void)
172  { return this->get_pairingPin(); }
173 
185  int set_pairingPin(const string& newval);
186  inline int setPairingPin(const string& newval)
187  { return this->set_pairingPin(newval); }
188 
196  string get_remoteAddress(void);
197 
198  inline string remoteAddress(void)
199  { return this->get_remoteAddress(); }
200 
210  int set_remoteAddress(const string& newval);
211  inline int setRemoteAddress(const string& newval)
212  { return this->set_remoteAddress(newval); }
213 
221  string get_remoteName(void);
222 
223  inline string remoteName(void)
224  { return this->get_remoteName(); }
225 
233  Y_MUTE_enum get_mute(void);
234 
235  inline Y_MUTE_enum mute(void)
236  { return this->get_mute(); }
237 
248  int set_mute(Y_MUTE_enum newval);
249  inline int setMute(Y_MUTE_enum newval)
250  { return this->set_mute(newval); }
251 
259  int get_preAmplifier(void);
260 
261  inline int preAmplifier(void)
262  { return this->get_preAmplifier(); }
263 
273  int set_preAmplifier(int newval);
274  inline int setPreAmplifier(int newval)
275  { return this->set_preAmplifier(newval); }
276 
284  int get_volume(void);
285 
286  inline int volume(void)
287  { return this->get_volume(); }
288 
298  int set_volume(int newval);
299  inline int setVolume(int newval)
300  { return this->set_volume(newval); }
301 
310  Y_LINKSTATE_enum get_linkState(void);
311 
313  { return this->get_linkState(); }
314 
323  int get_linkQuality(void);
324 
325  inline int linkQuality(void)
326  { return this->get_linkQuality(); }
327 
328  string get_command(void);
329 
330  inline string command(void)
331  { return this->get_command(); }
332 
333  int set_command(const string& newval);
334  inline int setCommand(const string& newval)
335  { return this->set_command(newval); }
336 
364  static YBluetoothLink* FindBluetoothLink(string func);
365 
379 
380  virtual int _invokeValueCallback(string value);
381 
389  virtual int connect(void);
390 
398  virtual int disconnect(void);
399 
400 
401  inline static YBluetoothLink* Find(string func)
402  { return YBluetoothLink::FindBluetoothLink(func); }
403 
411  YBluetoothLink *nextBluetoothLink(void);
412  inline YBluetoothLink *next(void)
413  { return this->nextBluetoothLink();}
414 
424  static YBluetoothLink* FirstBluetoothLink(void);
425  inline static YBluetoothLink* First(void)
427 #ifdef __BORLANDC__
428 #pragma option pop
429 #endif
430  //--- (end of YBluetoothLink accessors declaration)
431 };
432 
433 //--- (YBluetoothLink functions declaration)
434 
462 inline YBluetoothLink* yFindBluetoothLink(const string& func)
463 { return YBluetoothLink::FindBluetoothLink(func);}
475 
476 //--- (end of YBluetoothLink functions declaration)
477 
478 #endif
Y_MUTE_enum
Definition: yocto_audioin.h:57
#define YAPI_INVALID_UINT
Definition: yocto_api.h:71
virtual int _parseAttr(YJSONObject *json_val)
Definition: yocto_api.cpp:2367
virtual int registerValueCallback(YFunctionValueCallback callback)
Definition: yocto_api.cpp:2544
#define YOCTO_CLASS_EXPORT
Definition: yocto_api.h:61
virtual int _invokeValueCallback(string value)
Definition: yocto_api.cpp:2563


yoctopuce_altimeter
Author(s): Anja Sheppard
autogenerated on Mon Jun 10 2019 15:49:11