Comparing version 0.0.3 to 0.0.31
219
bglib.js
@@ -354,3 +354,2 @@ var bitwise = require('./libs/bitwise-ops'); | ||
var payloadEntry = this.rawPayload[i]; | ||
if ((typeof payloadEntry == 'number') || (typeof payloadEntry == 'string')) { | ||
@@ -360,4 +359,4 @@ | ||
for (var eachObj in b) { | ||
byteArray.push(b[eachObj]); | ||
for (var k = 0; k < b.length; k++) { | ||
byteArray.push(b[k]); | ||
} | ||
@@ -367,4 +366,3 @@ | ||
else if (Array.isArray(payloadEntry)) { | ||
for (var j in payloadEntry) { | ||
for (var j = 0; j< payloadEntry.length; j++) { | ||
var b = bitwise.getUint8ByteVal(payloadEntry[j]); | ||
@@ -455,3 +453,4 @@ | ||
// Eventually do something smarter here | ||
return console.log(e); | ||
console.log(e); | ||
continue; | ||
} | ||
@@ -477,3 +476,4 @@ // If it was a response | ||
// Eventually do something smarter here | ||
return console.log(e); | ||
console.log(e); | ||
continue; | ||
} | ||
@@ -637,12 +637,12 @@ | ||
case 8: | ||
var data_len = param.length; | ||
var data_len = param; | ||
payloadBytes.push(data_len); | ||
var totalPacketSize = data_len + command.header.payloadLowBits; | ||
command.header.payloadLowBits = getLowerBits(totalPacketSize); | ||
command.header.payloadHighBits = getUpperBits(totalPacketSize); | ||
var totalPacketSize = data_len + command.header.lolen; | ||
param = params.shift(); | ||
command.header.payloadLowBits = bitwise.getLowerBits(totalPacketSize); | ||
command.header.payloadHighBits = bitwise.getUpperBits(totalPacketSize); | ||
payloadBytes.push(param); | ||
@@ -660,3 +660,3 @@ | ||
var data_len = param; | ||
var data_len = param.length; | ||
@@ -666,7 +666,7 @@ payloadBytes.push(bitwise.getLowerBits(data_len)); | ||
var totalPacketSize = data_len + command.header.payloadLowBits; | ||
command.header.payloadLowBits = getLowerBits(totalPacketSize); | ||
command.header.payloadHighBits = getUpperBits(totalPacketSize); | ||
var totalPacketSize = data_len + command.header.lolen; | ||
command.header.payloadLowBits = bitwise.getLowerBits(totalPacketSize); | ||
command.header.payloadHighBits = bitwise.getUpperBits(totalPacketSize); | ||
param = params.shift(); | ||
// param = params.shift(); | ||
payloadBytes.push(param); | ||
@@ -729,114 +729,115 @@ break; | ||
// System | ||
systemReset : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.System, command : _bgcommandIDs.System_Reset}, paramCode: 0x02}, | ||
systemHello : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.System, command : _bgcommandIDs.System_Hello}, paramCode: 0x00}, | ||
// systemAddressGet : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.System, command : _bgcommandIDs.System_Address_Get}, paramCode: 0x00}, | ||
// systemRegisterWrite : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.System, command : _bgcommandIDs.System_Reg_Write}, paramCode: 0x24}, | ||
// systemRegisterRead : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.System, command : _bgcommandIDs.System_Reg_Read}, paramCode: 0x04}, | ||
// systemGetCounters : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.System, command : _bgcommandIDs.System_Get_Counters}, paramCode: 0x00}, | ||
// systemGetConnections : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.System, command : _bgcommandIDs.System_Get_Connections}, paramCode: 0x00}, | ||
// systemReadMemory : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.System, command : _bgcommandIDs.System_Read_Memory}, paramCode: 0x26}, | ||
// systemGetInfo : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.System, command : _bgcommandIDs.System_Get_Info}, paramCode: 0x00}, | ||
// systemEndpointTx : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.System, command : _bgcommandIDs.System_Endpoint_Tx}, paramCode: 0x82}, | ||
// systemWhitelistAppend : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.System, command : _bgcommandIDs.System_Whitelist_Append}, paramCode: 0x2a}, | ||
// systemWhitelistRemove : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.System, command : _bgcommandIDs.System_Whitelist_Remove}, paramCode: 0x2a}, | ||
// systemWhiteListClear : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.System, command : _bgcommandIDs.System_Whitelist_Clear}, paramCode: 0x00}, | ||
// systemEndpointRx : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.System, command : _bgcommandIDs.System_Endpoint_Rx}, paramCode: 0x22}, | ||
// systemEndpointSetWatermarks : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.System, command : _bgcommandIDs.System_Reg_Write}, paramCode: 0x222}, | ||
systemReset : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 1, cls : _bgcommandClass.System, command : _bgcommandIDs.System_Reset}, paramCode: 0x02}, | ||
systemHello : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 0, cls : _bgcommandClass.System, command : _bgcommandIDs.System_Hello}, paramCode: 0x00}, | ||
// systemAddressGet : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 0, cls : _bgcommandClass.System, command : _bgcommandIDs.System_Address_Get}, paramCode: 0x00}, | ||
// systemRegisterWrite : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 3, cls : _bgcommandClass.System, command : _bgcommandIDs.System_Reg_Write}, paramCode: 0x24}, | ||
// systemRegisterRead : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 2, cls : _bgcommandClass.System, command : _bgcommandIDs.System_Reg_Read}, paramCode: 0x04}, | ||
// systemGetCounters : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 0, cls : _bgcommandClass.System, command : _bgcommandIDs.System_Get_Counters}, paramCode: 0x00}, | ||
// systemGetConnections : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 0, cls : _bgcommandClass.System, command : _bgcommandIDs.System_Get_Connections}, paramCode: 0x00}, | ||
// systemReadMemory : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 5, cls : _bgcommandClass.System, command : _bgcommandIDs.System_Read_Memory}, paramCode: 0x26}, | ||
// systemGetInfo : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 0, cls : _bgcommandClass.System, command : _bgcommandIDs.System_Get_Info}, paramCode: 0x00}, | ||
// systemEndpointTx : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 2, cls : _bgcommandClass.System, command : _bgcommandIDs.System_Endpoint_Tx}, paramCode: 0x82}, | ||
// systemWhitelistAppend : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 7, cls : _bgcommandClass.System, command : _bgcommandIDs.System_Whitelist_Append}, paramCode: 0x2a}, | ||
// systemWhitelistRemove : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 7, cls : _bgcommandClass.System, command : _bgcommandIDs.System_Whitelist_Remove}, paramCode: 0x2a}, | ||
// systemWhiteListClear : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 0, cls : _bgcommandClass.System, command : _bgcommandIDs.System_Whitelist_Clear}, paramCode: 0x00}, | ||
// systemEndpointRx : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 2, cls : _bgcommandClass.System, command : _bgcommandIDs.System_Endpoint_Rx}, paramCode: 0x22}, | ||
// systemEndpointSetWatermarks : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 3, cls : _bgcommandClass.System, command : _bgcommandIDs.System_Reg_Write}, paramCode: 0x222}, | ||
// Persistent Storage | ||
// psDefrag : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.PersistentStore, command : _bgcommandIDs.Flash_PS_Defrag}, paramCode: 0x00}, | ||
// psDump : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.PersistentStore, command : _bgcommandIDs.Flash_PS_Dump}, paramCode: 0x00}, | ||
// psEraseAll : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.PersistentStore, command : _bgcommandIDs.Flash_PS_Erase_All}, paramCode: 0x00}, | ||
// psSave : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.PersistentStore, command : _bgcommandIDs.Flash_PS_Save}, paramCode: 0x84}, | ||
// psLoad : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.PersistentStore, command : _bgcommandIDs.Flash_PS_Load}, paramCode: 0x04}, | ||
// psErase : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.PersistentStore, command : _bgcommandIDs.Flash_PS_Erase}, paramCode: 0x04}, | ||
// flashErasePage : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.PersistentStore, command : _bgcommandIDs.Flash_Erase_Page}, paramCode: 0x02}, | ||
// flashWriteWords : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.PersistentStore, command : _bgcommandIDs.Flash_Write_Words}, paramCode: 0x84}, | ||
// psDefrag : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 0, cls : _bgcommandClass.PersistentStore, command : _bgcommandIDs.Flash_PS_Defrag}, paramCode: 0x00}, | ||
// psDump : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 0, cls : _bgcommandClass.PersistentStore, command : _bgcommandIDs.Flash_PS_Dump}, paramCode: 0x00}, | ||
// psEraseAll : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 0, cls : _bgcommandClass.PersistentStore, command : _bgcommandIDs.Flash_PS_Erase_All}, paramCode: 0x00}, | ||
// psSave : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 3, cls : _bgcommandClass.PersistentStore, command : _bgcommandIDs.Flash_PS_Save}, paramCode: 0x84}, | ||
// psLoad : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 2, cls : _bgcommandClass.PersistentStore, command : _bgcommandIDs.Flash_PS_Load}, paramCode: 0x04}, | ||
// psErase : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 2, cls : _bgcommandClass.PersistentStore, command : _bgcommandIDs.Flash_PS_Erase}, paramCode: 0x04}, | ||
// flashErasePage : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 1, cls : _bgcommandClass.PersistentStore, command : _bgcommandIDs.Flash_Erase_Page}, paramCode: 0x02}, | ||
// flashWriteWords : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 3, cls : _bgcommandClass.PersistentStore, command : _bgcommandIDs.Flash_Write_Words}, paramCode: 0x84}, | ||
// // Attribute Database | ||
// attributesWrite : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.AttributeDatabase, command : _bgcommandIDs.Attributes_Write}, paramCode: 0x824}, | ||
attributesRead : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.AttributeDatabase, command : _bgcommandIDs.Attributes_Read}, paramCode: 0x44}, | ||
attributesReadType : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.AttributeDatabase, command : _bgcommandIDs.Attributes_Read_Type}, paramCode: 0x04}, | ||
// attributesUserReadResponse : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.AttributeDatabase, command : _bgcommandIDs.Attributes_User_Read_Response}, paramCode: 0x822}, | ||
// attributesUserWriteResponse : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.AttributeDatabase, command : _bgcommandIDs.Attributes_User_Write_Response}, paramCode: 0x22}, | ||
attributesWrite : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 4, cls : _bgcommandClass.AttributeDatabase, command : _bgcommandIDs.Attributes_Write}, paramCode: 0x824}, | ||
attributesRead : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 4, cls : _bgcommandClass.AttributeDatabase, command : _bgcommandIDs.Attributes_Read}, paramCode: 0x44}, | ||
attributesReadType : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 2, cls : _bgcommandClass.AttributeDatabase, command : _bgcommandIDs.Attributes_Read_Type}, paramCode: 0x04}, | ||
// attributesUserReadResponse : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 3, cls : _bgcommandClass.AttributeDatabase, command : _bgcommandIDs.Attributes_User_Read_Response}, paramCode: 0x822}, | ||
// attributesUserWriteResponse : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 2, cls : _bgcommandClass.AttributeDatabase, command : _bgcommandIDs.Attributes_User_Write_Response}, paramCode: 0x22}, | ||
// // Connection | ||
// connectionDisconnect : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.Connection, command : _bgcommandIDs.Connection_Disconnect}, paramCode: 0x02}, | ||
// connectionGetRSSI : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.Connection, command : _bgcommandIDs.Connection_Get_RSSI}, paramCode: 0x02}, | ||
// connectionUpdate : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.Connection, command : _bgcommandIDs.Connection_Update}, paramCode: 0x44442}, | ||
// connectionVersion : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.Connection, command : _bgcommandIDs.Connection_Version_Update}, paramCode: 0x02}, | ||
// connectionChannelMapGet : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.Connection, command : _bgcommandIDs.Connection_Channel_Map_Get}, paramCode: 0x02}, | ||
// connectionChannelMapSet : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.Connection, command : _bgcommandIDs.Connection_Channel_Map_Set}, paramCode: 0x82}, | ||
// connectionFeaturesGet : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.Connection, command : _bgcommandIDs.Connection_Features_Get}, paramCode: 0x02}, | ||
// connectionGetStatus : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.Connection, command : _bgcommandIDs.Connection_Get_Status}, paramCode: 0x02}, | ||
// connectionRawTx : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.Connection, command : _bgcommandIDs.Connection_Raw_Tx}, paramCode: 0x82}, | ||
connectionDisconnect : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 1, cls : _bgcommandClass.Connection, command : _bgcommandIDs.Connection_Disconnect}, paramCode: 0x02}, | ||
// connectionGetRSSI : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 1, cls : _bgcommandClass.Connection, command : _bgcommandIDs.Connection_Get_RSSI}, paramCode: 0x02}, | ||
// connectionUpdate : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 9, cls : _bgcommandClass.Connection, command : _bgcommandIDs.Connection_Update}, paramCode: 0x44442}, | ||
// connectionVersion : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 1, cls : _bgcommandClass.Connection, command : _bgcommandIDs.Connection_Version_Update}, paramCode: 0x02}, | ||
// connectionChannelMapGet : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 1, cls : _bgcommandClass.Connection, command : _bgcommandIDs.Connection_Channel_Map_Get}, paramCode: 0x02}, | ||
// connectionChannelMapSet : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 2, cls : _bgcommandClass.Connection, command : _bgcommandIDs.Connection_Channel_Map_Set}, paramCode: 0x82}, | ||
// connectionFeaturesGet : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 1, cls : _bgcommandClass.Connection, command : _bgcommandIDs.Connection_Features_Get}, paramCode: 0x02}, | ||
// connectionGetStatus : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 1, cls : _bgcommandClass.Connection, command : _bgcommandIDs.Connection_Get_Status}, paramCode: 0x02}, | ||
// connectionRawTx : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 2, cls : _bgcommandClass.Connection, command : _bgcommandIDs.Connection_Raw_Tx}, paramCode: 0x82}, | ||
// // Attribute Client | ||
attClientFindByTypeValue : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.AttributeClient, command : _bgcommandIDs.Attclient_Find_By_Type_Value}, paramCode: 0x84442}, | ||
// attClientReadByGroupType : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.AttributeClient, command : _bgcommandIDs.Attclient_Read_By_Group_Type}, paramCode: 0x84442}, | ||
// attClientReadByType : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.AttributeClient, cid : _bgcommandIDs.Attclient_Read_By_Type}, paramCode: 0x84442}, | ||
attClientFindInformation : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.AttributeClient, command : _bgcommandIDs.Attclient_Find_Information}, paramCode: 0x442}, | ||
attClientReadByHandle : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.AttributeClient, command : _bgcommandIDs.Attclient_Read_By_Handle}, paramCode: 0x42}, | ||
// attClientAttributeWrite : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.AttributeClient, command : _bgcommandIDs.Attclient_Attribute_Write}, paramCode: 0x842}, | ||
// attClientWriteCommand : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.AttributeClient, command : _bgcommandIDs.Attclient_Write_Command}, paramCode: 0x842}, | ||
// attClientIndicateConfirm : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.AttributeClient, command : _bgcommandIDs.Attclient_Indicate_Confirm}, paramCode: 0x02}, | ||
// attClientReadLong : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.AttributeClient, command : _bgcommandIDs.Attclient_Read_Long}, paramCode: 0x8442}, | ||
// attClientPrepareWrite : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.AttributeClient, command : _bgcommandIDs.Attclient_Prepare_Write}, paramCode: 0x22}, | ||
// attClientReadMultiple : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.AttributeClient, command : _bgcommandIDs.Attclient_Read_Multiple}, paramCode: 0x82}, | ||
attClientFindByTypeValue : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 8, cls : _bgcommandClass.AttributeClient, command : _bgcommandIDs.Attclient_Find_By_Type_Value}, paramCode: 0x84442}, | ||
// attClientReadByGroupType : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 6, cls : _bgcommandClass.AttributeClient, command : _bgcommandIDs.Attclient_Read_By_Group_Type}, paramCode: 0x84442}, | ||
// attClientReadByType : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 6, cls : _bgcommandClass.AttributeClient, cid : _bgcommandIDs.Attclient_Read_By_Type}, paramCode: 0x84442}, | ||
attClientFindInformation : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 5, cls : _bgcommandClass.AttributeClient, command : _bgcommandIDs.Attclient_Find_Information}, paramCode: 0x442}, | ||
attClientReadByHandle : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 3, cls : _bgcommandClass.AttributeClient, command : _bgcommandIDs.Attclient_Read_By_Handle}, paramCode: 0x42}, | ||
// attClientAttributeWrite : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 4, cls : _bgcommandClass.AttributeClient, command : _bgcommandIDs.Attclient_Attribute_Write}, paramCode: 0x842}, | ||
// attClientWriteCommand : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 4, cls : _bgcommandClass.AttributeClient, command : _bgcommandIDs.Attclient_Write_Command}, paramCode: 0x842}, | ||
// attClientIndicateConfirm : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 1, cls : _bgcommandClass.AttributeClient, command : _bgcommandIDs.Attclient_Indicate_Confirm}, paramCode: 0x02}, | ||
// attClientReadLong : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 3, cls : _bgcommandClass.AttributeClient, command : _bgcommandIDs.Attclient_Read_Long}, paramCode: 0x8442}, | ||
// attClientPrepareWrite : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 6, cls : _bgcommandClass.AttributeClient, command : _bgcommandIDs.Attclient_Prepare_Write}, paramCode: 0x22}, | ||
// attClientExecuteWrite : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 2, cls : _bgcommandClass.AttributeClient, command : _bgcommandIDs.Attclient_Execute_Write}, paramCode: 0x22}, | ||
// attClientReadMultiple : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 2, cls : _bgcommandClass.AttributeClient, command : _bgcommandIDs.Attclient_Read_Multiple}, paramCode: 0x82}, | ||
// // Security Manager | ||
// smEncryptStart : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.SecurityManager, command : _bgcommandIDs.SM_Encrypt_Start}, paramCode: 0x22}, | ||
// smSetBondableMode : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.SecurityManager, command : _bgcommandIDs.SM_Set_Bondable_Mode}, paramCode: 0x02}, | ||
// smDeleteBonding : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.SecurityManager, command : _bgcommandIDs.SM_Delete_Bonding}, paramCode: 0x02}, | ||
// smSetParameters : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.SecurityManager, command : _bgcommandIDs.SM_Set_Parameters}, paramCode: 0x222}, | ||
// smPasskeyEntry : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.SecurityManager, command : _bgcommandIDs.SM_Passkey_Entry}, paramCode: 0x62}, | ||
// smGetBonds : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.SecurityManager, command : _bgcommandIDs.SM_Get_Bonds}, paramCode: 0x00}, | ||
// smSetOOBData: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.SecurityManager, command : _bgcommandIDs.SM_Set_OOB_Data}, paramCode: 0x08}, | ||
// smEncryptStart : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 2, cls : _bgcommandClass.SecurityManager, command : _bgcommandIDs.SM_Encrypt_Start}, paramCode: 0x22}, | ||
// smSetBondableMode : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 1, cls : _bgcommandClass.SecurityManager, command : _bgcommandIDs.SM_Set_Bondable_Mode}, paramCode: 0x02}, | ||
// smDeleteBonding : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 1, cls : _bgcommandClass.SecurityManager, command : _bgcommandIDs.SM_Delete_Bonding}, paramCode: 0x02}, | ||
// smSetParameters : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 3, cls : _bgcommandClass.SecurityManager, command : _bgcommandIDs.SM_Set_Parameters}, paramCode: 0x222}, | ||
// smPasskeyEntry : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 5, cls : _bgcommandClass.SecurityManager, command : _bgcommandIDs.SM_Passkey_Entry}, paramCode: 0x62}, | ||
// smGetBonds : {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 0, cls : _bgcommandClass.SecurityManager, command : _bgcommandIDs.SM_Get_Bonds}, paramCode: 0x00}, | ||
// smSetOOBData: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 1, cls : _bgcommandClass.SecurityManager, command : _bgcommandIDs.SM_Set_OOB_Data}, paramCode: 0x08}, | ||
// GAP | ||
// gapSetPrivacyFlags: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.GenericAccessProfile, command : _bgcommandIDs.GAP_Set_Privacy_Flags}, paramCode: 0x22}, | ||
gapSetMode: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.GenericAccessProfile, command : _bgcommandIDs.GAP_Set_Mode}, paramCode: 0x22}, | ||
gapDiscover: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.GenericAccessProfile, command : _bgcommandIDs.GAP_Discover}, paramCode: 0x02}, | ||
gapConnectDirect: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.GenericAccessProfile, command : _bgcommandIDs.GAP_Connect_Direct}, paramCode: 0x44442a}, | ||
gapEndProcedure: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.GenericAccessProfile, command : _bgcommandIDs.GAP_End_Procedure}, paramCode: 0x00}, | ||
// gapConnectSelective: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.GenericAccessProfile, command : _bgcommandIDs.GAP_Connect_Selective}, paramCode: 0x4444}, | ||
// gapSetFiltering: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.GenericAccessProfile, command : _bgcommandIDs.GAP_Set_Filtering}, paramCode: 0x222}, | ||
// gapSetScanParameters: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.GenericAccessProfile, command : _bgcommandIDs.GAP_Set_Scan_Parameters}, paramCode: 0x244}, | ||
// gapSetAdvParameters: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.GenericAccessProfile, command : _bgcommandIDs.GAP_Set_Adv_Parameters}, paramCode: 0x244}, | ||
// gapSetAdvData: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.GenericAccessProfile, command : _bgcommandIDs.GAP_Set_Adv_Data}, paramCode: 0x82}, | ||
// gapSetDirectedConnectable: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.GenericAccessProfile, command : _bgcommandIDs.GAP_Set_Directed_Connectable_Mode}, paramCode: 0x2a}, | ||
// gapSetPrivacyFlags: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 2, cls : _bgcommandClass.GenericAccessProfile, command : _bgcommandIDs.GAP_Set_Privacy_Flags}, paramCode: 0x22}, | ||
gapSetMode: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 2, cls : _bgcommandClass.GenericAccessProfile, command : _bgcommandIDs.GAP_Set_Mode}, paramCode: 0x22}, | ||
gapDiscover: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 1, cls : _bgcommandClass.GenericAccessProfile, command : _bgcommandIDs.GAP_Discover}, paramCode: 0x02}, | ||
gapConnectDirect: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 0xf, cls : _bgcommandClass.GenericAccessProfile, command : _bgcommandIDs.GAP_Connect_Direct}, paramCode: 0x44442a}, | ||
gapEndProcedure: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 0, cls : _bgcommandClass.GenericAccessProfile, command : _bgcommandIDs.GAP_End_Procedure}, paramCode: 0x00}, | ||
// gapConnectSelective: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 8, cls : _bgcommandClass.GenericAccessProfile, command : _bgcommandIDs.GAP_Connect_Selective}, paramCode: 0x4444}, | ||
// gapSetFiltering: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 3, cls : _bgcommandClass.GenericAccessProfile, command : _bgcommandIDs.GAP_Set_Filtering}, paramCode: 0x222}, | ||
// gapSetScanParameters: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 5, cls : _bgcommandClass.GenericAccessProfile, command : _bgcommandIDs.GAP_Set_Scan_Parameters}, paramCode: 0x244}, | ||
// gapSetAdvParameters: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 5, cls : _bgcommandClass.GenericAccessProfile, command : _bgcommandIDs.GAP_Set_Adv_Parameters}, paramCode: 0x244}, | ||
// gapSetAdvData: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 2, cls : _bgcommandClass.GenericAccessProfile, command : _bgcommandIDs.GAP_Set_Adv_Data}, paramCode: 0x82}, | ||
// gapSetDirectedConnectable: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 7, cls : _bgcommandClass.GenericAccessProfile, command : _bgcommandIDs.GAP_Set_Directed_Connectable_Mode}, paramCode: 0x2a}, | ||
// // Hardware | ||
// hwIOPortConfigIRQ: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.Hardware, command : _bgcommandIDs.HW_IO_Port_Config_IRQ}, paramCode: 0x222}, | ||
// hwSetSoftTimer: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.Hardware, command : _bgcommandIDs.HW_Set_Soft_Timer}, paramCode: 0x226}, | ||
// hwADCReadID: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.Hardware, command : _bgcommandIDs.HW_ADC_Read}, paramCode: 0x222}, | ||
// hwIOPortConfigDirection: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.Hardware, command : _bgcommandIDs.HW_IO_Port_Config_Direction}, paramCode: 0x22}, | ||
// hwIOPortConfigFunction: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.Hardware, command : _bgcommandIDs.HW_IO_Port_Config_Function}, paramCode: 0x22}, | ||
// hwIOPortConfigPull: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.Hardware, command : _bgcommandIDs.HW_IO_Port_Config_Pull}, paramCode: 0x222}, | ||
// hwIOPortWrite: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.Hardware, command : _bgcommandIDs.HW_IO_Port_Write}, paramCode: 0x222}, | ||
// hwIOPortRead: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.Hardware, command : _bgcommandIDs.HW_IO_Port_Read}, paramCode: 0x22}, | ||
// hwSPIConfig: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.Hardware, command : _bgcommandIDs.HW_SPI_Config}, paramCode: 0x222222}, | ||
// hwSPITransfer: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.Hardware, command : _bgcommandIDs.HW_SPI_Transfer}, paramCode: 0x824}, | ||
// hwI2CRead: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.Hardware, command : _bgcommandIDs.HW_I2C_Read}, paramCode: 0x222}, | ||
// hwI2CWrite: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.Hardware, command : _bgcommandIDs.HW_I2C_Write}, paramCode: 0x822}, | ||
// hwSetTxPower: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.Hardware, command : _bgcommandIDs.HW_Set_Tx_Power}, paramCode: 0x02}, | ||
// hwTimerComparator: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.Hardware, command : _bgcommandIDs.HW_Timer_Comparator}, paramCode: 0x4222}, | ||
// hwIOPortConfigIRQ: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 3, cls : _bgcommandClass.Hardware, command : _bgcommandIDs.HW_IO_Port_Config_IRQ}, paramCode: 0x222}, | ||
// hwSetSoftTimer: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 6, cls : _bgcommandClass.Hardware, command : _bgcommandIDs.HW_Set_Soft_Timer}, paramCode: 0x226}, | ||
// hwADCReadID: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 3, cls : _bgcommandClass.Hardware, command : _bgcommandIDs.HW_ADC_Read}, paramCode: 0x222}, | ||
// hwIOPortConfigDirection: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 2, cls : _bgcommandClass.Hardware, command : _bgcommandIDs.HW_IO_Port_Config_Direction}, paramCode: 0x22}, | ||
// hwIOPortConfigFunction: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 2, cls : _bgcommandClass.Hardware, command : _bgcommandIDs.HW_IO_Port_Config_Function}, paramCode: 0x22}, | ||
// hwIOPortConfigPull: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 3, cls : _bgcommandClass.Hardware, command : _bgcommandIDs.HW_IO_Port_Config_Pull}, paramCode: 0x222}, | ||
// hwIOPortWrite: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 3, cls : _bgcommandClass.Hardware, command : _bgcommandIDs.HW_IO_Port_Write}, paramCode: 0x222}, | ||
// hwIOPortRead: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 2, cls : _bgcommandClass.Hardware, command : _bgcommandIDs.HW_IO_Port_Read}, paramCode: 0x22}, | ||
// hwSPIConfig: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 6, cls : _bgcommandClass.Hardware, command : _bgcommandIDs.HW_SPI_Config}, paramCode: 0x222222}, | ||
// hwSPITransfer: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 2, cls : _bgcommandClass.Hardware, command : _bgcommandIDs.HW_SPI_Transfer}, paramCode: 0x824}, | ||
// hwI2CRead: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 3, cls : _bgcommandClass.Hardware, command : _bgcommandIDs.HW_I2C_Read}, paramCode: 0x222}, | ||
// hwI2CWrite: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 3, cls : _bgcommandClass.Hardware, command : _bgcommandIDs.HW_I2C_Write}, paramCode: 0x822}, | ||
// hwSetTxPower: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 1, cls : _bgcommandClass.Hardware, command : _bgcommandIDs.HW_Set_Tx_Power}, paramCode: 0x02}, | ||
// hwTimerComparator: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 5, cls : _bgcommandClass.Hardware, command : _bgcommandIDs.HW_Timer_Comparator}, paramCode: 0x4222}, | ||
// // Test | ||
// testPhyTx: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.Test, command : _bgcommandIDs.Test_Phy_Tx}, paramCode: 0x00}, | ||
// testPhyRx: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.Test, command : _bgcommandIDs.Test_Phy_Rx}, paramCode: 0x00}, | ||
// testPhyEnd: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.Test, command : _bgcommandIDs.Test_Phy_End}, paramCode: 0x04}, | ||
// testPhyReset: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.Test, command : _bgcommandIDs.Test_Phy_Reset}, paramCode: 0x00}, | ||
// testGetChannelMap: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.Test, command : _bgcommandIDs.Test_Get_Channel_Map}, paramCode: 0x08}, | ||
// testDebug {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.Test, command : _bgcommandIDs.Test_Debug}, paramCode: 0x08}, | ||
// testgetChannelMode: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.Test, command : _bgcommandIDs.Test_Channel_Mode}, paramCode: 0x00}, | ||
// testPhyTx: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 3, cls : _bgcommandClass.Test, command : _bgcommandIDs.Test_Phy_Tx}, paramCode: 0x00}, | ||
// testPhyRx: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 1, cls : _bgcommandClass.Test, command : _bgcommandIDs.Test_Phy_Rx}, paramCode: 0x00}, | ||
// testPhyEnd: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 0, cls : _bgcommandClass.Test, command : _bgcommandIDs.Test_Phy_End}, paramCode: 0x04}, | ||
// testPhyReset: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 0, cls : _bgcommandClass.Test, command : _bgcommandIDs.Test_Phy_Reset}, paramCode: 0x00}, | ||
// testGetChannelMap: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 0, cls : _bgcommandClass.Test, command : _bgcommandIDs.Test_Get_Channel_Map}, paramCode: 0x08}, | ||
// testDebug {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 1, cls : _bgcommandClass.Test, command : _bgcommandIDs.Test_Debug}, paramCode: 0x08}, | ||
// testgetChannelMode: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 1, cls : _bgcommandClass.Test, command : _bgcommandIDs.Test_Channel_Mode}, paramCode: 0x00}, | ||
// // DFU | ||
dfuReset: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.DFU, command : _bgcommandIDs.DFU_Reset}, paramCode: 0x02}, | ||
// dfuFlashSetAddress: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.DFU, command : _bgcommandIDs.DFU_Flash_Set_Address}, paramCode: 0x06}, | ||
// dfuFlashUpload: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.DFU, command : _bgcommandIDs.DFU_Flash_Upload}, paramCode: 0x08}, | ||
// dfuFlashUploadFinish: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, cls : _bgcommandClass.DFU, command : _bgcommandIDs.DFU_Flash_Upload_Finish}, paramCode: 0x04}, | ||
dfuReset: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 1, cls : _bgcommandClass.DFU, command : _bgcommandIDs.DFU_Reset}, paramCode: 0x02}, | ||
// dfuFlashSetAddress: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 4, cls : _bgcommandClass.DFU, command : _bgcommandIDs.DFU_Flash_Set_Address}, paramCode: 0x06}, | ||
// dfuFlashUpload: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 1, cls : _bgcommandClass.DFU, command : _bgcommandIDs.DFU_Flash_Upload}, paramCode: 0x08}, | ||
// dfuFlashUploadFinish: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 0, cls : _bgcommandClass.DFU, command : _bgcommandIDs.DFU_Flash_Upload_Finish}, paramCode: 0x04}, | ||
} | ||
@@ -843,0 +844,0 @@ |
var bitwise = require('./bitwise-ops'); | ||
var errorHandler = require('./bglib-errors'); | ||
@@ -86,55 +87,55 @@ /*************************************** | ||
} | ||
// var _bgEventConnectionFeatureInd = function(params) { | ||
// this.connection = params[0]; | ||
// this.features = bitwise.numberFromUint8Bytes([params[1], params[2]]); | ||
// } | ||
// var _bgEventConnectionRawRx = function(params) { | ||
// this.connection = params[0]; | ||
// this.data = bitwise.numberFromUint8Bytes([params[1], params[2]]); | ||
// } | ||
var _bgEventConnectionFeatureInd = function(params) { | ||
this.connection = params[0]; | ||
this.features = bitwise.numberFromUint8Bytes([params[1], params[2]]); | ||
} | ||
var _bgEventConnectionRawRx = function(params) { | ||
this.connection = params[0]; | ||
this.data = bitwise.numberFromUint8Bytes([params[1], params[2]]); | ||
} | ||
var _bgEventConnectionDisconnected = function(params) { | ||
this.connection = params[0]; | ||
this.reason = bitwise.numberFromUint8Bytes([params[1], params[2]]); | ||
this.reason = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes([params[1], params[2]])); | ||
} | ||
// /*************************************** | ||
// * Attribute Client Events | ||
// ****************************************/ | ||
/*************************************** | ||
* Attribute Client Events | ||
****************************************/ | ||
// var _bgEventAttClientIndicated = function(params) { | ||
// this.connection = params[0]; | ||
// this.attrhandle = bitwise.numberFromUint8Bytes([params[1], params[2]]); | ||
// } | ||
var _bgEventAttClientIndicated = function(params) { | ||
this.connection = params[0]; | ||
this.attrhandle = bitwise.numberFromUint8Bytes([params[1], params[2]]); | ||
} | ||
var _bgEventAttClientProcedureCompleted = function(params) { | ||
this.connection = params[0]; | ||
this.result = bitwise.numberFromUint8Bytes([params[1], params[2]]); | ||
this.result = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes([params[1], params[2]])); | ||
this.chrhandle = bitwise.numberFromUint8Bytes([params[3], params[4]]); | ||
} | ||
// var _bgEventAttClientGroupFound = function(params) { | ||
// this.connection = params[0]; | ||
// this.start = bitwise.numberFromUint8Bytes([params[1], params[2]]); | ||
// this.end = bitwise.numberFromUint8Bytes([params[3], params[4]]); | ||
// this.uuid = params[5]; | ||
// } | ||
var _bgEventAttClientGroupFound = function(params) { | ||
this.connection = params[0]; | ||
this.start = bitwise.numberFromUint8Bytes([params[1], params[2]]); | ||
this.end = bitwise.numberFromUint8Bytes([params[3], params[4]]); | ||
this.uuid = params[5]; | ||
} | ||
var _bgEventAttClientFindInformationFound = function(params) { | ||
this.connection = params[0]; | ||
this.chrhandle = bitwise.numberFromUint8Bytes([params[1], params[2]]); | ||
this.uuid = params[3]; | ||
this.uuid = bitwise.numberFromUint8Bytes(params.splice(3, params.length - 3)); | ||
} | ||
// var _bgEventAttClientGroupFound = function(params) { | ||
// this.connection = params[0]; | ||
// this.start = bitwise.numberFromUint8Bytes([params[1], params[2]]); | ||
// this.end = bitwise.numberFromUint8Bytes([params[3], params[4]]); | ||
// this.uuid = params[5]; | ||
// } | ||
// var _bgEventAttClientAttributeValue = function(params) { | ||
// this.connection = params[0]; | ||
// this.atthandle = bitwise.numberFromUint8Bytes([params[1], params[2]]); | ||
// this.type = params[3] | ||
// this.value = params[4]; | ||
// } | ||
// var _bgEventAttClientReadMultipleResponse = function(params) { | ||
// this.connection = params[0]; | ||
// this.handles = params[1]; | ||
// } | ||
var _bgEventAttClientGroupFound = function(params) { | ||
this.connection = params[0]; | ||
this.start = bitwise.numberFromUint8Bytes([params[1], params[2]]); | ||
this.end = bitwise.numberFromUint8Bytes([params[3], params[4]]); | ||
this.uuid = params[5]; | ||
} | ||
var _bgEventAttClientAttributeValue = function(params) { | ||
this.connection = params[0]; | ||
this.atthandle = bitwise.numberFromUint8Bytes([params[1], params[2]]); | ||
this.type = params[3] | ||
this.value = params.splice(4, params.length - 4); | ||
} | ||
var _bgEventAttClientReadMultipleResponse = function(params) { | ||
this.connection = params[0]; | ||
this.handles = params[1]; | ||
} | ||
// /*************************************** | ||
@@ -211,8 +212,8 @@ // * Security Manager Events | ||
// Connection Events | ||
3: [_bgEventConnectionStatus, _bgEventConnectionVersionInd, null, null, // _bgEventConnectionFeatureInd,*/ | ||
/*_bgEventConnectionRawRx,*/ _bgEventConnectionDisconnected], | ||
3: [_bgEventConnectionStatus, _bgEventConnectionVersionInd, _bgEventConnectionFeatureInd, | ||
_bgEventConnectionRawRx, _bgEventConnectionDisconnected], | ||
// Attribute Client Events | ||
4: [/*_bgEventAttClientIndicated*/null, _bgEventAttClientProcedureCompleted, null, //_bgEventAttClientGroupFound, | ||
_bgEventAttClientFindInformationFound, null],//_bgEventAttClientGroupFound], //_bgEventAttClientAttributeValue, | ||
4: [_bgEventAttClientIndicated, _bgEventAttClientProcedureCompleted, _bgEventAttClientGroupFound,_bgEventAttClientGroupFound, | ||
_bgEventAttClientFindInformationFound, _bgEventAttClientAttributeValue], | ||
// _bgEventAttClientReadMultipleResponse], | ||
@@ -219,0 +220,0 @@ |
var bitwise = require('./bitwise-ops'); | ||
var errorHandler = require('./bglib-errors'); | ||
@@ -102,11 +103,11 @@ /*************************************** | ||
// ****************************************/ | ||
// var _bgResponseAttributesWrite = function(params) { | ||
// this.result = bitwise.numberFromUint8Bytes(params[0], params[1]); | ||
// } | ||
// var _bgResponseAttributesRead = function(params) { | ||
// this.handle = bitwise.numberFromUint8Bytes(params[0], params[1]); | ||
// this.offset = bitwise.numberFromUint8Bytes(params[2], params[3]); | ||
// this.result = bitwise.numberFromUint8Bytes(params[4], params[5]); | ||
// this.value = params[6]; | ||
// } | ||
var _bgResponseAttributesWrite = function(params) { | ||
this.result = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes(params[0], params[1])); | ||
} | ||
var _bgResponseAttributesRead = function(params) { | ||
this.handle = bitwise.numberFromUint8Bytes(params[0], params[1]); | ||
this.offset = bitwise.numberFromUint8Bytes(params[2], params[3]); | ||
this.result = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes(params[4], params[5])); | ||
this.value = params.splice(6, params.length - 6); | ||
} | ||
// var _bgResponseAttributesReadType = function(params) { | ||
@@ -124,15 +125,14 @@ // this.handle = bitwise.numberFromUint8Bytes(params[0], params[1]); | ||
// /*************************************** | ||
// * Connection | ||
// ****************************************/ | ||
// var _bgResponseConnectionDisconnect = function(params) { | ||
/*************************************** | ||
* Connection | ||
****************************************/ | ||
var _bgResponseConnectionDisconnect = function(params) { | ||
this.connection = params[0]; | ||
this.result = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes(params[1], params[2])); | ||
} | ||
// var _bgResponseConnectionGetRSSI = function(params) { | ||
// this.connection = params[0]; | ||
// this.result = bitwise.numberFromUint8Bytes(params[1], params[2]); | ||
// this.rssi = params[1]; | ||
// } | ||
var _bgResponseConnectionGetRSSI = function(params) { | ||
console.log("params: ", params); | ||
this.connection = params[0]; | ||
this.rssi = params[1]; | ||
} | ||
// var _bgResponseConnectionUpdate = function(params) { | ||
@@ -166,21 +166,21 @@ // this.connection = params[0]; | ||
this.connection = params[0]; | ||
this.result = bitwise.numberFromUint8Bytes(params[1], params[2]); | ||
this.result = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes(params[1], params[2])); | ||
} | ||
var _bgResponseAttClientReadByGroupType = function(params) { | ||
this.connection = params[0]; | ||
this.result = bitwise.numberFromUint8Bytes(params[1], params[2]); | ||
this.result = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes(params[1], params[2])); | ||
} | ||
var _bgResponseAttClientReadByType = function(params) { | ||
this.connection = params[0]; | ||
this.result = bitwise.numberFromUint8Bytes(params[1], params[2]); | ||
this.result = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes(params[1], params[2])); | ||
} | ||
var _bgResponseAttClientFindInformation = function(params) { | ||
this.connection = params[0]; | ||
this.result = getErrorFromCode(bitwise.numberFromUint8Bytes(params[1], params[2])); | ||
this.result = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes(params[1], params[2])); | ||
} | ||
// var _bgResponseAttClientReadByHandle = function(params) { | ||
// this.connection = params[0]; | ||
// this.result = bitwise.numberFromUint8Bytes(params[1], params[2]); | ||
// } | ||
var _bgResponseAttClientReadByHandle = function(params) { | ||
this.connection = params[0]; | ||
this.result = bitwise.numberFromUint8Bytes(params[1], params[2]); | ||
} | ||
// var _bgResponseAttClientAttributeWrite = function(params) { | ||
@@ -190,6 +190,6 @@ // this.connection = params[0]; | ||
// } | ||
// var _bgResponseAttClientWriteCommand = function(params) { | ||
// this.connection = params[0]; | ||
// this.result = bitwise.numberFromUint8Bytes(params[1], params[2]); | ||
// } | ||
var _bgResponseAttClientWriteCommand = function(params) { | ||
this.connection = params[0]; | ||
this.result = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes(params[1], params[2])); | ||
} | ||
// var _bgResponseAttClientIndicateConfirm = function(params) { | ||
@@ -245,32 +245,32 @@ // this.connection = bitwise.numberFromUint8Bytes(params[0], params[1]); | ||
var _bgResponseGAPSetMode = function(params) { | ||
this.result = getErrorFromCode(bitwise.numberFromUint8Bytes(params[0], params[1])); | ||
this.result = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes(params[0], params[1])); | ||
} | ||
var _bgResponseGAPDiscover= function(params) { | ||
this.result = getErrorFromCode(bitwise.numberFromUint8Bytes(params[0], params[1])); | ||
this.result = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes(params[0], params[1])); | ||
} | ||
var _bgResponseGAPConnectDirect = function(params) { | ||
this.result = getErrorFromCode(bitwise.numberFromUint8Bytes(params[0], params[1])); | ||
this.result = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes(params[0], params[1])); | ||
this.connection_handle = params[2]; | ||
} | ||
var _bgResponseGAPEndProcedure = function(params) { | ||
this.result = getErrorFromCode(bitwise.numberFromUint8Bytes(params[0], params[1])); | ||
this.result = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes(params[0], params[1])); | ||
} | ||
var _bgResponseGAPConnectSelective = function(params) { | ||
this.result = getErrorFromCode(bitwise.numberFromUint8Bytes(params[0], params[1])); | ||
this.connection_handle = params[2]; | ||
} | ||
var _bgResponseGAPSetFiltering = function(params) { | ||
this.result = getErrorFromCode(bitwise.numberFromUint8Bytes(params[0], params[1])); | ||
} | ||
var _bgResponseGAPSetScanParameters = function(params) { | ||
this.result = getErrorFromCode(bitwise.numberFromUint8Bytes(params[0], params[1])); | ||
} | ||
var _bgResponseGAPSetAdvParameters = function(params) { | ||
this.result = getErrorFromCode(bitwise.numberFromUint8Bytes(params[0], params[1])); | ||
} | ||
var _bgResponseGAPSetAdvData = function(params) { | ||
this.result = getErrorFromCode(bitwise.numberFromUint8Bytes(params[0], params[1])); | ||
} | ||
// var _bgResponseGAPConnectSelective = function(params) { | ||
// this.result = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes(params[0], params[1])); | ||
// this.connection_handle = params[2]; | ||
// } | ||
// var _bgResponseGAPSetFiltering = function(params) { | ||
// this.result = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes(params[0], params[1])); | ||
// } | ||
// var _bgResponseGAPSetScanParameters = function(params) { | ||
// this.result = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes(params[0], params[1])); | ||
// } | ||
// var _bgResponseGAPSetAdvParameters = function(params) { | ||
// this.result = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes(params[0], params[1])); | ||
// } | ||
// var _bgResponseGAPSetAdvData = function(params) { | ||
// this.result = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes(params[0], params[1])); | ||
// } | ||
var _bgResponseGAPSetDirectedConnectableMode = function(params) { | ||
this.result = getErrorFromCode(bitwise.numberFromUint8Bytes(params[0], params[1])); | ||
this.result = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes(params[0], params[1])); | ||
} | ||
@@ -386,13 +386,13 @@ | ||
// // Attribute Database Responses | ||
// 2 : [_bgResponseAttributesWrite, _bgResponseAttributesRead, _bgResponseAttributesReadType, | ||
2 : [_bgResponseAttributesWrite, _bgResponseAttributesRead],// _bgResponseAttributesReadType], | ||
// _bgResponseAttributesUserReadResponse, _bgResponseAttributesUserWriteResponse], | ||
// // Connection Responses | ||
3 : /*[_bgResponseConnectionDisconnect,*/[_bgResponseConnectionGetRSSI, //_bgResponseConnectionUpdate, | ||
3 : [_bgResponseConnectionDisconnect],//_bgResponseConnectionGetRSSI], //_bgResponseConnectionUpdate, | ||
// _bgResponseConnectionChannelMapGet, _bgResponseConnectionChannelMapSet, _bgResponseConnectionFeaturesGet, | ||
_bgResponseConnectionGetStatus],// _bgResponseConnectionRawTx], | ||
//_bgResponseConnectionGetStatus],// _bgResponseConnectionRawTx], | ||
// // Attribute Client Responses | ||
4 : [_bgResponseAttClientFindByType, _bgResponseAttClientReadByGroupType, _bgResponseAttClientReadByType, | ||
_bgResponseAttClientFindInformation],// _bgResponseAttClientReadByHandle, _bgResponseAttClientAttributeWrite, | ||
_bgResponseAttClientFindInformation, _bgResponseAttClientReadByHandle], //_bgResponseAttClientAttributeWrite, | ||
// _bgResponseAttClientWriteCommand, _bgResponseAttClientIndicateConfirm, _bgResponseAttClientReadLong, | ||
@@ -407,3 +407,3 @@ // _bgResponseAttClientPrepareWrite, _bgResponseAttClientExecuteWrite, _bgResponseAttClientReadMultiple], | ||
6 : [_bgResponseGAPSetPrivacyFlags, _bgResponseGAPSetMode, _bgResponseGAPDiscover, | ||
_bgResponseGAPConnectDirect, _bgResponseGAPEndProcedure, _bgResponseGAPConnectSelective], | ||
_bgResponseGAPConnectDirect, _bgResponseGAPEndProcedure],// _bgResponseGAPConnectSelective], | ||
// _bgResponseGAPSetFiltering, _bgResponseGAPSetScanParameters, _bgResponseGAPSetAdvParameters, | ||
@@ -428,134 +428,4 @@ // _bgResponseGAPSetAdvData, _bgResponseGAPSetDirectedConnectableMode], | ||
function getErrorFromCode(errorCode) { | ||
var e = new BGLibError(); | ||
switch(errorCode) { | ||
case 0x00: | ||
return 0x00; | ||
//BGAPI Errors | ||
case 0x180: | ||
e.message = "Invalid Parameter"; | ||
e.detail = "Command contained invalid parameter"; | ||
return e; | ||
case 0x181: | ||
e.message = "Device in Wrong State"; | ||
e.detail = "Device is in wrong state to receive command"; | ||
return e; | ||
case 0x182: | ||
e.message = "Out Of Memory"; | ||
e.detail = "Device has run out of memory"; | ||
return e; | ||
case 0x183: | ||
e.message = "Feature Not Implemented"; | ||
e.detail = "Feature is not implemented"; | ||
case 0x184: | ||
e.message = "Command Not Recognized"; | ||
e.detail = "Command was not recognized"; | ||
case 0x185: | ||
e.message = "Timeout"; | ||
e.detail = "Command or Procedure failed due to timeout"; | ||
case 0x186: | ||
e.message = "Not Connected"; | ||
e.detail = "Connection handle passed is to command is not a valid handle"; | ||
case 0x187: | ||
e.message = "Flow"; | ||
e.detail = "Command would cause either underflow or overflow error"; | ||
case 0x188: | ||
e.message = "User Attribute"; | ||
e.detail = "User attribute was accessed through API which is not supported"; | ||
case 0x189: | ||
e.message = "Invalid License Key"; | ||
e.detail = "No valid license key found"; | ||
case 0x18A: | ||
e.message = "Command Too Long"; | ||
e.detail = "Command would cause either underflow or overflow error"; | ||
case 0x187: | ||
e.message = "Out of Bonds"; | ||
e.detail = "Bonding procedure can't be started because device has no space left for bond."; | ||
//Bluetooth Errors | ||
case 0x205: | ||
e.message = "Authentication Failure"; | ||
e.detail = "Pairing or authentication failed due to incorrect results in the pairing or authentication procedure. This could be due to an incorrect PIN or Link Key"; | ||
case 0x206: | ||
e.message = "Pin or Key Missing"; | ||
e.detail = "Pairing failed because of missing PIN, or authentication failed because of missing Key."; | ||
case 0x207: | ||
e.message = "Memory Capacity Exceeded"; | ||
e.detail = "Controller is out of memory."; | ||
case 0x208: | ||
e.message = "Connection Timeout"; | ||
e.detail = "Link supervision timeout has expired."; | ||
case 0x209: | ||
e.message = "Connection Limit Exceeded"; | ||
e.detail = "Controller is at limit of connections it can support."; | ||
case 0x20C: | ||
e.message = "Command Disallowed"; | ||
e.detail = "Command requested cannot be executed because the Controller is in a state where it cannot process this command at this time."; | ||
case 0x212: | ||
e.message = "Invalid Command Parameters"; | ||
e.detail = "Command contained invalid parameters." | ||
return e; | ||
case 0x213: | ||
e.message = "Remote User Terminated Connection"; | ||
e.detail = "User on the remote device terminated the connection."; | ||
case 0x216: | ||
e.message = "Connection Terminated by Local Host"; | ||
e.detail = "Local device terminated the connection."; | ||
case 0x222: | ||
e.message = "LL Response Timeout"; | ||
e.detail = "CConnection terminated due to link-layer procedure timeout."; | ||
case 0x228: | ||
e.message = "LL Instant Passed"; | ||
e.detail = "Received link-layer control packet where instant was in the past."; | ||
case 0x23A: | ||
e.message = "Controller Busy"; | ||
e.detail = "Operation was rejected because the controller is busy and unable to process the request."; | ||
case 0x23B: | ||
e.message = "Unacceptable Connection Interval"; | ||
e.detail = "The Unacceptable Connection Interval error code indicates that the remote device terminated the connection because of an unacceptable connection interval."; | ||
case 0x23C: | ||
e.message = "Directed Advertising Timeout"; | ||
e.detail = "Directed advertising completed without a connection being created."; | ||
case 0x23D: | ||
e.message = "MIC Failure"; | ||
e.detail = "Connection was terminated because the Message Integrity Check (MIC) failed on a received packet."; | ||
case 0x23E: | ||
e.message = "Connection Failed to be Established"; | ||
e.detail = "LL initiated a connection but the connection has failed to be established. Controller did not receive any packets from remote end."; | ||
// Security Errors | ||
case 0x301: | ||
e.message = "Passkey Entry Failed"; | ||
e.detail = "The user input of passkey failed, for example, the user cancelled the operation"; | ||
case 0x302: | ||
e.message = "OOB Data is not available"; | ||
e.detail = "Out of Band data is not available for authentication."; | ||
case 0x303: | ||
e.message = "Authentication Requirements"; | ||
e.detail = "The pairing procedure cannot be performed as authentication requirements cannot be met due to IO capabilities of one or both devices"; | ||
case 0x304: | ||
e.message = "Confirm Value Failed"; | ||
e.detail = "The confirm value does not match the calculated compare value."; | ||
case 0x305: | ||
e.message = "Pairing Not Supported"; | ||
e.detail = "Pairing is not supported by the device."; | ||
case 0x306: | ||
e.message = "Encryption Key Size"; | ||
e.detail = "CThe resultant encryption key size is insufficient for the security requirements of this device."; | ||
case 0x307: | ||
e.message = "Command Not Supported"; | ||
e.detail = "The SMP command received is not supported on this device."; | ||
case 0x308: | ||
e.message = "Unspecified Reason"; | ||
e.detail = "Pairing failed due to an unspecified reason."; | ||
} | ||
return -1; | ||
} | ||
function BGLibError() { | ||
this.message = "Generic BGLib Error"; | ||
this.detail = ""; | ||
} | ||
module.exports.Responses = Responses; |
@@ -43,6 +43,4 @@ function getUpperBits(num) { | ||
for (var i = 0; i < string.length; i++) { | ||
bytes.push(string.charCodeAt(i)); | ||
} | ||
return bytes; | ||
@@ -68,3 +66,3 @@ } | ||
var num = 0; | ||
for (var i in bytes) { | ||
for (var i = 0; i < bytes.length; i++) { | ||
num += (bytes[i] << (i * 8)) | ||
@@ -71,0 +69,0 @@ } |
{ | ||
"name": "bglib", | ||
"version": "0.0.3", | ||
"version": "0.0.31", | ||
"description": "Create and parse packets for the BlueGiga BLE112 and BLE113", | ||
@@ -5,0 +5,0 @@ "main": "bglib.js", |
@@ -1,40 +0,1 @@ | ||
##BGLib | ||
BGLib is a Node library for sending and receiving packets from BlueGiga BLE devices (currently supports ble112 and ble113). It is still under heavy development and will likely not work as intended for a while. It is currently being developed by Technical Machine to support our Tessel BLE module. | ||
I still need to replace bitwise functions with Buffers once those are fully functional on Tessel. | ||
##Install | ||
``` | ||
npm install bglib | ||
``` | ||
##Examples | ||
###Creating a packet | ||
``` | ||
var bglib = new require('bglib').bglib(); | ||
bglib.getPacket(bglib.api.systemHello); // Returns [0, 0, 0, 1] | ||
bglib.getPacket(bglib.api.gapDiscover, [1, 0], function(err, response) { | ||
console.log("Packet: ", response); | ||
}) | ||
``` | ||
###Parsing Incoming Data | ||
``` | ||
var bglib = new require('bglib').bglib(); | ||
var incomingBytes = [0, 0, 0, 1]; | ||
bglib.parseIncoming(incomingBytes, function(err, parsedPackets) { | ||
console.log("Parsed packets: ", parsedPackets); | ||
}) | ||
``` | ||
The library will hold the current state of the packets so you can pass in pieces of a packet and it will return the entire parsed packet when it has all been passed in. | ||
###Thanks | ||
JRowberg deserves a special shout-out. Some of the code is modeled after [his Arduino bglib work](https://github.com/jrowberg/bglib). |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
71455
1497
2