41 #define _CRT_SECURE_NO_DEPRECATE //do not use windows secure crt 49 #define __FILE_ID__ "bluetoothlink" 53 ,_ownAddress(OWNADDRESS_INVALID)
54 ,_pairingPin(PAIRINGPIN_INVALID)
55 ,_remoteAddress(REMOTEADDRESS_INVALID)
56 ,_remoteName(REMOTENAME_INVALID)
58 ,_preAmplifier(PREAMPLIFIER_INVALID)
59 ,_volume(VOLUME_INVALID)
60 ,_linkState(LINKSTATE_INVALID)
61 ,_linkQuality(LINKQUALITY_INVALID)
62 ,_command(COMMAND_INVALID)
63 ,_valueCallbackBluetoothLink(NULL)
84 if(json_val->
has(
"ownAddress")) {
87 if(json_val->
has(
"pairingPin")) {
90 if(json_val->
has(
"remoteAddress")) {
93 if(json_val->
has(
"remoteName")) {
96 if(json_val->
has(
"mute")) {
99 if(json_val->
has(
"preAmplifier")) {
102 if(json_val->
has(
"volume")) {
105 if(json_val->
has(
"linkState")) {
108 if(json_val->
has(
"linkQuality")) {
111 if(json_val->
has(
"command")) {
140 }
catch (std::exception) {
173 }
catch (std::exception) {
199 res =
_setAttr(
"pairingPin", rest_val);
200 }
catch (std::exception) {
229 }
catch (std::exception) {
253 res =
_setAttr(
"remoteAddress", rest_val);
254 }
catch (std::exception) {
283 }
catch (std::exception) {
312 }
catch (std::exception) {
336 rest_val = (newval>0 ?
"1" :
"0");
338 }
catch (std::exception) {
367 }
catch (std::exception) {
390 char buf[32]; sprintf(buf,
"%d", newval); rest_val = string(buf);
391 res =
_setAttr(
"preAmplifier", rest_val);
392 }
catch (std::exception) {
421 }
catch (std::exception) {
444 char buf[32]; sprintf(buf,
"%d", newval); rest_val = string(buf);
446 }
catch (std::exception) {
476 }
catch (std::exception) {
506 }
catch (std::exception) {
528 }
catch (std::exception) {
543 res =
_setAttr(
"command", rest_val);
544 }
catch (std::exception) {
592 }
catch (std::exception) {
614 if (callback != NULL) {
621 if (callback != NULL && this->
isOnline()) {
676 vector<YFUN_DESCR> v_fundescr;
678 string serial, funcId, funcName, funcVal, errmsg;
681 v_fundescr.size() == 0 ||
virtual int _parseAttr(YJSONObject *json_val)
static const string REMOTEADDRESS_INVALID
Y_LINKSTATE_enum _linkState
int set_pairingPin(const string &newval)
yCRITICAL_SECTION _this_cs
static YBluetoothLink * FindBluetoothLink(string func)
static const int LINKQUALITY_INVALID
virtual int _invokeValueCallback(string value)
static YBluetoothLink * FirstBluetoothLink(void)
YRETCODE _load_unsafe(int msValidity)
static const int PREAMPLIFIER_INVALID
int set_volume(int newval)
YBluetoothLink(const string &func)
static int DefaultCacheValidity
string getString(const string &key)
YBluetoothLink * nextBluetoothLink(void)
string get_remoteAddress(void)
static const string COMMAND_INVALID
void yLeaveCriticalSection(yCRITICAL_SECTION *cs)
Y_LINKSTATE_enum get_linkState(void)
static YRETCODE getFunctionInfo(YFUN_DESCR fundesc, YDEV_DESCR &devdescr, string &serial, string &funcId, string &funcName, string &funcVal, string &errmsg)
#define YAPI_INVALID_STRING
string get_pairingPin(void)
virtual int _parseAttr(YJSONObject *json_val)
int get_preAmplifier(void)
int set_mute(Y_MUTE_enum newval)
virtual int registerValueCallback(YBluetoothLinkValueCallback callback)
string get_ownAddress(void)
int getInt(const string &key)
static const int VOLUME_INVALID
static u64 GetTickCount(void)
static const string PAIRINGPIN_INVALID
YBluetoothLinkValueCallback _valueCallbackBluetoothLink
static void _AddToCache(const string &classname, const string &func, YFunction *obj)
int set_command(const string &newval)
int set_remoteAddress(const string &newval)
static YFunction * _FindFromCache(const string &classname, const string &func)
static const Y_MUTE_enum MUTE_INVALID
void yEnterCriticalSection(yCRITICAL_SECTION *cs)
static yCRITICAL_SECTION _global_cs
int get_linkQuality(void)
static const string OWNADDRESS_INVALID
static int getFunctionsByClass(const string &class_str, YFUN_DESCR prevfundesc, vector< YFUN_DESCR > &buffer, int maxsize, string &errmsg)
string get_remoteName(void)
int set_preAmplifier(int newval)
virtual int connect(void)
virtual int disconnect(void)
static bool _apiInitialized
YRETCODE _nextFunction(string &hwId)
static void _UpdateValueCallbackList(YFunction *func, bool add)
bool has(const string &key)
YRETCODE _setAttr(string attrname, string newvalue)
Y_MUTE_enum get_mute(void)
static const Y_LINKSTATE_enum LINKSTATE_INVALID
void(* YBluetoothLinkValueCallback)(YBluetoothLink *func, const string &functionValue)
static const string REMOTENAME_INVALID
virtual int _invokeValueCallback(string value)