Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bglib

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bglib - npm Package Compare versions

Comparing version 0.0.31 to 0.0.51

test/test.js

470

bglib.js

@@ -5,7 +5,4 @@ var bitwise = require('./libs/bitwise-ops');

var _bglibPMode;
var _bglibPMode = 0;
var PACKET_MODE = 1;
var FLOW_CONTROL = 0;
var DEBUG = 0;

@@ -24,3 +21,2 @@

var _bgcommandClass = {

@@ -155,91 +151,91 @@ System : 0,

// // System Enumerations
// bglib.prototype.Endpoints = {
// system_endpoint_api : 0,
// system_endpoint_test : 1,
// system_endpoint_script : 2,
// system_endpoint_usb : 3,
// system_endpoint_uart0 : 4,
// system_endpoint_uart1 : 5,
// }
// System Enumerations
bglib.prototype.Endpoints = {
system_endpoint_api : 0,
system_endpoint_test : 1,
system_endpoint_script : 2,
system_endpoint_usb : 3,
system_endpoint_uart0 : 4,
system_endpoint_uart1 : 5,
}
// // Attribute Database Enumerations
// bglib.prototype.AttributeChangeReason = {
// attributes_attribute_change_reason_write_request : 0,
// attributes_attribute_change_reason_write_command : 1,
// attributes_attribute_change_reason_write_request_user : 2,
// }
// Attribute Database Enumerations
bglib.prototype.AttributeChangeReason = {
attributes_attribute_change_reason_write_request : 0,
attributes_attribute_change_reason_write_command : 1,
attributes_attribute_change_reason_write_request_user : 2,
}
// bglib.prototype.AttributeStatusFlags = {
// attributes_attribute_status_flag_notify : 1,
// attributes_attribute_status_flag_indicate : 2,
// }
bglib.prototype.AttributeStatusFlags = {
attributes_attribute_status_flag_notify : 1,
attributes_attribute_status_flag_indicate : 2,
}
// // Connection Enumerations
// bglib.prototype.ConnectionStatus = {
// connection_connected : 1,
// connection_encrypted : 1 << 1,
// connection_completed : 1 << 2,
// connection_parameters_change : 1 << 3,
// }
// Connection Enumerations
bglib.prototype.ConnectionStatus = {
connection_connected : 1,
connection_encrypted : 1 << 1,
connection_completed : 1 << 2,
connection_parameters_change : 1 << 3,
}
// // Attribute Client Enumerations
// bglib.prototype.AttributeValueType = {
// attclient_attribute_value_type_read : 0,
// attclient_attribute_value_type_notify : 1,
// attclient_attribute_value_type_indicate : 2,
// attclient_attribute_value_type_read_by_type : 3,
// attclient_attribute_value_type_read_blob : 4,
// attclient_attribute_value_type_indicate_rsp_req : 5,
// }
// Attribute Client Enumerations
bglib.prototype.AttributeValueType = {
attclient_attribute_value_type_read : 0,
attclient_attribute_value_type_notify : 1,
attclient_attribute_value_type_indicate : 2,
attclient_attribute_value_type_read_by_type : 3,
attclient_attribute_value_type_read_blob : 4,
attclient_attribute_value_type_indicate_rsp_req : 5,
}
// // Security Manager Enumerations
// bglib.prototype.BondingKeys = {
// sm_bonding_key_ltk : 0x01,
// sm_bonding_key_addr_public : 0x02,
// sm_bonding_key_addr_static : 0x04,
// sm_bonding_key_irk : 0x08,
// sm_bonding_key_edivrand : 0x10,
// sm_bonding_key_csrk : 0x20,
// sm_bonding_key_masterid : 0x40,
// }
// Security Manager Enumerations
bglib.prototype.BondingKeys = {
sm_bonding_key_ltk : 0x01,
sm_bonding_key_addr_public : 0x02,
sm_bonding_key_addr_static : 0x04,
sm_bonding_key_irk : 0x08,
sm_bonding_key_edivrand : 0x10,
sm_bonding_key_csrk : 0x20,
sm_bonding_key_masterid : 0x40,
}
// bglib.prototype.SMPIO = {
// sm_io_capability_displayonly : 0,
// sm_io_capability_displayyesno : 1,
// sm_io_capability_keyboardonly : 2,
// sm_io_capability_noinputnooutput : 3,
// sm_io_capability_keyboarddisplay : 4,
// }
bglib.prototype.SMPIO = {
sm_io_capability_displayonly : 0,
sm_io_capability_displayyesno : 1,
sm_io_capability_keyboardonly : 2,
sm_io_capability_noinputnooutput : 3,
sm_io_capability_keyboarddisplay : 4,
}
// // GAP Enumerations
// bglib.prototype.AD_Flags = {
// GAP_AD_FLAG_LIMITED_DISCOVERABLE : 0x01,
// GAP_AD_FLAG_GENERAL_DISCOVERABLE : 0x02,
// GAP_AD_FLAG_BREDR_NOT_SUPPORTED : 0x04,
// GAP_AD_FLAG_SIMULTANEOUS_LEBREDR_CTRL : 0x10,
// GAP_AD_FLAG_SIMULTANEOUS_LEBREDR_HOST : 0x20,
// GAP_AD_FLAG_MASK : 0x1f
// }
// GAP Enumerations
bglib.prototype.AD_Flags = {
GAP_AD_FLAG_LIMITED_DISCOVERABLE : 0x01,
GAP_AD_FLAG_GENERAL_DISCOVERABLE : 0x02,
GAP_AD_FLAG_BREDR_NOT_SUPPORTED : 0x04,
GAP_AD_FLAG_SIMULTANEOUS_LEBREDR_CTRL : 0x10,
GAP_AD_FLAG_SIMULTANEOUS_LEBREDR_HOST : 0x20,
GAP_AD_FLAG_MASK : 0x1f
}
// bglib.prototype.ADTypeFlags = {
// gap_ad_type_none : 0,
// gap_ad_type_flags : 1,
// gap_ad_type_services_16bit_more : 2,
// gap_ad_type_services_16bit_all : 3,
// gap_ad_type_services_32bit_more : 4,
// gap_ad_type_services_32bit_al : 5,
// gap_ad_type_services_128bit_more : 6,
// gap_ad_type_services_128bit_all : 7,
// gap_ad_type_localname_short : 8,
// gap_ad_type_localname_complete : 9,
// gap_ad_type_txpower : 10,
// }
bglib.prototype.ADTypeFlags = {
gap_ad_type_none : 0,
gap_ad_type_flags : 1,
gap_ad_type_services_16bit_more : 2,
gap_ad_type_services_16bit_all : 3,
gap_ad_type_services_32bit_more : 4,
gap_ad_type_services_32bit_al : 5,
gap_ad_type_services_128bit_more : 6,
gap_ad_type_services_128bit_all : 7,
gap_ad_type_localname_short : 8,
gap_ad_type_localname_complete : 9,
gap_ad_type_txpower : 10,
}
// bglib.prototype.AdvertistingPolicy = {
// gap_adv_policy_all : 0,
// gap_adv_policy_whitelist_scan : 1,
// gap_adv_policy_whitelist_connect : 2,
// gap_adv_policy_whitelist_all : 3,
// }
bglib.prototype.AdvertistingPolicy = {
gap_adv_policy_all : 0,
gap_adv_policy_whitelist_scan : 1,
gap_adv_policy_whitelist_connect : 2,
gap_adv_policy_whitelist_all : 3,
}

@@ -273,16 +269,16 @@ bglib.prototype.BluetoothAddressTypes = {

// bglib.prototype.SCAN_HEADER_FLAGS = {
// GAP_SCAN_HEADER_ADV_IND : 0,
// GAP_SCAN_HEADER_ADV_DIRECT_IND : 1,
// GAP_SCAN_HEADER_ADV_NONCONN_IND : 2,
// GAP_SCAN_HEADER_SCAN_REQ : 3,
// GAP_SCAN_HEADER_SCAN_RSP : 4,
// GAP_SCAN_HEADER_CONNECT_REQ : 5,
// GAP_SCAN_HEADER_ADV_DISCOVER_IND : 6,
// }
bglib.prototype.SCAN_HEADER_FLAGS = {
GAP_SCAN_HEADER_ADV_IND : 0,
GAP_SCAN_HEADER_ADV_DIRECT_IND : 1,
GAP_SCAN_HEADER_ADV_NONCONN_IND : 2,
GAP_SCAN_HEADER_SCAN_REQ : 3,
GAP_SCAN_HEADER_SCAN_RSP : 4,
GAP_SCAN_HEADER_CONNECT_REQ : 5,
GAP_SCAN_HEADER_ADV_DISCOVER_IND : 6,
}
// bglib.prototype.ScanPolicy = {
// gap_scan_policy_all : 0,
// gap_scan_policy_whitelist : 1
// }
bglib.prototype.ScanPolicy = {
gap_scan_policy_all : 0,
gap_scan_policy_whitelist : 1
}

@@ -385,3 +381,2 @@ function Packet(packetHeader, payload) {

Payload.prototype.getPayloadByteSize = function() {

@@ -391,10 +386,2 @@ return this.getByteArray().length;

function ArgumentException(message) {
this.name = "ArgumentException";
this.message = message;
}
var ParsedPacket = function(packet, responseType, response) {

@@ -406,4 +393,3 @@ this.packet = packet;

function bglib(packetMode) {
_bglibPMode = packetMode;
function bglib() {
this.bgapiRXBuffer = [];

@@ -414,2 +400,8 @@ this.bgapiRXBufferPos = 0;

// IF you are not using packet mode, you'll need to
// set this variable so the length of the packets
// are appended to the packet.
bglib.prototype.setPacketMode = function(pMode) {
_bglibPMode = pMode;
}

@@ -439,2 +431,11 @@ bglib.prototype.parseIncoming = function(incomingBytes, callback) {

if (packet.packetHeader.cClass < 0
|| packet.packetHeader.cClass > Object.keys(_bgcommandClass).length) {
if (DEBUG) console.log("Packet with invalid class");
console.log("Popping packet with class: ", packet.packetHeader.cClass);
packets.splice(i, 1);
i--;
continue;
}
// If this packet is an event

@@ -447,4 +448,6 @@ if ((packet.packetHeader.mType & 0x80) == 0x80) {

var eventCreator;
// Check to see if we have an event object for this packet
if ((eventCreator=libEvent.Events[packet.packetHeader.cClass][packet.packetHeader.cID])) {
// Create the event object
// Create the event object
data = new eventCreator(packet.payload.rawPayload);

@@ -460,2 +463,3 @@

// Eventually do something smarter here
console.log("Yeah, it was here...")
console.log(e);

@@ -483,2 +487,3 @@ continue;

// Eventually do something smarter here
console.log("Yeah, it was maybe here...")
console.log(e);

@@ -494,3 +499,3 @@ continue;

// Return all the packets
callback && callback(err, parsedReturn);

@@ -523,6 +528,23 @@

this.bgapiRXBuffer[this.bgapiRXBufferPos++] = ch;
// If not, something screwy happened
// If not, something screwy happened
} else {
// console.log("Warning: Packet Frame Issue.");
if (DEBUG) console.log("Warning: Packet Frame Issue.");
// Try to move forward to the next packet frame.
while (i < incomingBytes.length) {
// If it's an event or response header
if (incomingBytes[i] == 0x80 || incomingBytes[i] == 0x00) {
// Go back one byte (because loop iteration will increase)
i--;
// Break out of while loop
break;
} else {
i++;
}
}
// return;

@@ -584,3 +606,2 @@ continue;

callback(null, packets);

@@ -601,7 +622,21 @@

return this.verifyParams(command.paramCode, params, function(err) {
// To allow consumers to not pass in an empty array when
// they don't have params, check if the callback
// was passed as second argument
if (!callback && typeof params == "function") {
console.log("Switching");
callback = params;
params = [];
}
if (typeof callback != "function") {
throw new Error("Invalid Paramters passed: More than allowed.");
}
this.verifyParams(command.paramCode, params, function(err) {
// There's a problem with the params passed in.
if (err) {
return callback(err, null);
callback && callback(err, null);
return;
}

@@ -687,6 +722,11 @@

// Create a new payload
var payload = new Payload(payloadBytes);
// Get the size of the payload to make the packet header
var payloadSize = payload.getPayloadByteSize();
// Make the packet header
var header = new PacketHeader(_bgmessageType.Command,

@@ -699,6 +739,9 @@ _bgtechnologyType.Bluetooth,

var packet = new Packet(header, payload)
// Make the packet with the payload and header
var packet = new Packet(header, payload);
// Call the callback
callback && callback(null, packet);
// Return the packet if it was lazily created
return packet;

@@ -710,9 +753,16 @@ });

numParams = 0;
var numParams = 0;
// If there are no params
if (!params) {
// And the param code indicates that there should be, throw an err
if (paramCode) return callback(new Error("Invalid parameters passed"));
else return callback();
// If there shouldn't be, just return
else return callback(null);
}
// Calculate the number of params there should be
while (paramCode & 0xF) {

@@ -723,6 +773,5 @@ numParams++;

console.log("Num params", numParams);
// Make sure the number passed in is correct
if (numParams != params.length) {
console.log("Number of params should be: " + numParams);
console.log("Instead there are: ", params.length);
return callback(new Error("Invalid parameters passed"));

@@ -734,6 +783,2 @@ } else {

bglib.prototype.getEventName = function(eventClass, eventCommand){
return libEvent.EventNames[eventClass][eventCommand];
}
bglib.prototype.api = {

@@ -744,72 +789,72 @@

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},
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, 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},
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
// Attribute Database
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},
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
// Connection
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},
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
// Attribute Client
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},
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},
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, 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},
// Security Manager
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, lolen : 2, cls : _bgcommandClass.GenericAccessProfile, command : _bgcommandIDs.GAP_Set_Privacy_Flags}, paramCode: 0x22},
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},

@@ -819,43 +864,42 @@ gapDiscover: {header : {tType: _bgtechnologyType.Bluetooth, mType: _bgmessageType.Command, lolen : 1, cls : _bgcommandClass.GenericAccessProfile, command : _bgcommandIDs.GAP_Discover}, paramCode: 0x02},

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},
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, 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},
// Hardware
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, 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},
// Test
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
// DFU
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},
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},
}
module.exports = new bglib();
module.exports.bglib = bglib;
module.exports.PACKET_MODE = PACKET_MODE;
// module.exports.FLOW_CONTROL = FLOW_CONTROL;

@@ -16,57 +16,57 @@ var bitwise = require('./bitwise-ops');

}
// var _bgEventSystemDebug = function(params) {
// this.data = params[0];
// }
// var _bgEventSystemEndpointWatermarkRx = function(params) {
// this.endpoint = params[0];
// this.data = params[1];
// }
// var _bgEventSystemEndpointWatermarkTx = function(params) {
// this.endpoint = params[0];
// this.data = params[1];
// }
// var _bgEventSystemScriptFailure = function(params) {
// this.address = bitwise.numberFromUint8Bytes([params[0], params[1]]);
// this.reason = bitwise.numberFromUint8Bytes([params[2], params[3]]);
// }
// var _bgEventSystemNoLicenseKey = function(params) {
var _bgEventSystemDebug = function(params) {
this.data = params[0];
}
var _bgEventSystemEndpointWatermarkRx = function(params) {
this.endpoint = params[0];
this.data = params[1];
}
var _bgEventSystemEndpointWatermarkTx = function(params) {
this.endpoint = params[0];
this.data = params[1];
}
var _bgEventSystemScriptFailure = function(params) {
this.address = bitwise.numberFromUint8Bytes([params[0], params[1]]);
this.reason = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes([params[2], params[3]]));
}
var _bgEventSystemNoLicenseKey = function(params) {
// }
// var _bgEventSystemProtocolError = function(params) {
// this.reason = bitwise.numberFromUint8Bytes([params[0], params[1]]);
// }
}
var _bgEventSystemProtocolError = function(params) {
this.reason = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes([params[0], params[1]]));
}
// /***************************************
// * Persistent Storage Events
// ****************************************/
/***************************************
* Persistent Storage Events
****************************************/
// var _bgEventFlashPSKey = function(params) {
// var key = bitwise.numberFromUint8Bytes([params[0], params[1]]);
// var data = params[2];
// }
var _bgEventFlashPSKey = function(params) {
this.key = bitwise.numberFromUint8Bytes([params[0], params[1]]);
this.value = params[2];
}
// /***************************************
// * Attribute Database Events
// ****************************************/
/***************************************
* Attribute Database Events
****************************************/
// var _bgEventAttributesValue = function(params) {
// this.connection = params[0];
// this.reason = params[1]
// this.offset = bitwise.numberFromUint8Bytes([params[2], params[3]]);
// this.handle = bitwise.numberFromUint8Bytes([params[4], params[5]]);
// this.value = params[6];
// }
// var _bgEventAttributesUserReadRequest = function(params) {
// this.connection = params[0];
// this.handle = bitwise.numberFromUint8Bytes([params[1], params[2]]);
// this.offset = bitwise.numberFromUint8Bytes([params[3], params[4]]);
// this.maxsize = params[5]
// }
// var _bgEventAtributesStatus = function(params) {
// this.handle = bitwise.numberFromUint8Bytes([params[0], params[1]]);
// this.flags = params[2];
// }
// /***************************************
// * Connection Events
// ****************************************/
var _bgEventAttributesValue = function(params) {
this.connection = params[0];
this.reason = params[1]
this.offset = bitwise.numberFromUint8Bytes([params[2], params[3]]);
this.handle = bitwise.numberFromUint8Bytes([params[4], params[5]]);
this.value = params[6];
}
var _bgEventAttributesUserReadRequest = function(params) {
this.connection = params[0];
this.handle = bitwise.numberFromUint8Bytes([params[1], params[2]]);
this.offset = bitwise.numberFromUint8Bytes([params[3], params[4]]);
this.maxsize = params[5]
}
var _bgEventAtributesStatus = function(params) {
this.handle = bitwise.numberFromUint8Bytes([params[0], params[1]]);
this.flags = params[2];
}
/***************************************
* Connection Events
****************************************/
var _bgEventConnectionStatus = function(params) {

@@ -141,28 +141,28 @@ this.connection = params[0];

}
// /***************************************
// * Security Manager Events
// ****************************************/
// var _bgEventSMSMPData = function(params) {
// this.handle = params[0];
// this.packet = params[1];
// this.data = params[2];
// }
// var _bgEventSMBondingFail = function(params) {
// this.handle = params[0];
// this.result = bitwise.numberFromUint8Bytes([params[1], params[2]]);
// }
// var _bgEventSMPasskeyDisplay = function(params) {
// this.handle = params[0];
// this.passkey = this.result = bitwise.numberFromUint8Bytes([params[1], params[2], params[3], params[4]]);
// }
// var _bgEventSMPasskeyRequest = function(params) {
// this.handle = params[0];
// }
// var _bgEventSMBondStatus = function(params) {
// this.bond = params[0];
// this.keysize = params[1];
// this.mitm = params[2];
// this.keys = params[3];
// }
/***************************************
* Security Manager Events
****************************************/
var _bgEventSMSMPData = function(params) {
this.handle = params[0];
this.packet = params[1];
this.data = params[2];
}
var _bgEventSMBondingFail = function(params) {
this.handle = params[0];
this.result = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes([params[1], params[2]]));
}
var _bgEventSMPasskeyDisplay = function(params) {
this.handle = params[0];
this.passkey = bitwise.numberFromUint8Bytes([params[1], params[2], params[3], params[4]]);
}
var _bgEventSMPasskeyRequest = function(params) {
this.handle = params[0];
}
var _bgEventSMBondStatus = function(params) {
this.bond = params[0];
this.keysize = params[1];
this.mitm = params[2];
this.keys = params[3];
}
/***************************************
* GAP Events

@@ -202,11 +202,11 @@ ****************************************/

// System Events
0: [_bgEventSystemBoot],// _bgEventSystemDebug, _bgEventSystemEndpointWatermarkRx,
// _bgEventSystemEndpointWatermarkTx, _bgEventSystemScriptFailure, _bgEventSystemNoLicenseKey,
// _bgEventSystemProtocolError],
0: [_bgEventSystemBoot, _bgEventSystemDebug, _bgEventSystemEndpointWatermarkRx,
_bgEventSystemEndpointWatermarkTx, _bgEventSystemScriptFailure, _bgEventSystemNoLicenseKey,
_bgEventSystemProtocolError],
// PS Events
// 1: [_bgEventFlashPSKey],
1: [_bgEventFlashPSKey],
// Attribute Database Events
// 2: [_bgEventAttributesValue, _bgEventAttributesUserReadRequest, _bgEventAtributesStatus],
2: [_bgEventAttributesValue, _bgEventAttributesUserReadRequest, _bgEventAtributesStatus],

@@ -219,8 +219,8 @@ // Connection Events

4: [_bgEventAttClientIndicated, _bgEventAttClientProcedureCompleted, _bgEventAttClientGroupFound,_bgEventAttClientGroupFound,
_bgEventAttClientFindInformationFound, _bgEventAttClientAttributeValue],
// _bgEventAttClientReadMultipleResponse],
_bgEventAttClientFindInformationFound, _bgEventAttClientAttributeValue,
_bgEventAttClientReadMultipleResponse],
// Security Manager Events
// 5: [_bgEventSMSMPData, _bgEventSMBondingFail, _bgEventSMPasskeyDisplay,
// _bgEventSMPasskeyRequest, _bgEventSMBondStatus],
5: [_bgEventSMSMPData, _bgEventSMBondingFail, _bgEventSMPasskeyDisplay,
_bgEventSMPasskeyRequest, _bgEventSMBondStatus],

@@ -231,3 +231,3 @@ // GAP Events

// Hardware Events
7: [_bgEventHWPortStatusChange],//, _bgEventHWADCResult, var_bgEventHWDFUBoot],
7: [_bgEventHWPortStatusChange, _bgEventHWADCResult, var_bgEventHWDFUBoot],
}

@@ -234,0 +234,0 @@

@@ -13,28 +13,28 @@ var bitwise = require('./bitwise-ops');

}
// var _bgResponseAddressGet = function(params) {
// this.address = [params[0], params[1], params[2], params[3], params[4], params[5]];
// }
// var _bgResponseRegisterWrite = function(params) {
// this.result = bitwise.numberFromUint8Bytes(params[0], param[1]);
// }
// var _bgResponseRegisterRead = function(params) {
// this.result = bitwise.numberFromUint8Bytes(params[0], param[1]);
// this.value = params[2];
// }
// var _bgResponseGetCounters = function(params) {
// this.txok = params[0];
// this.txretry = params[1];
// this.rxok = params[2];
// this.rxfail = params[3];
// this.mbuf = params[4];
// }
var _bgResponseAddressGet = function(params) {
this.address = [params[0], params[1], params[2], params[3], params[4], params[5]];
}
var _bgResponseRegisterWrite = function(params) {
this.result = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes(params[0], params[1]));
}
var _bgResponseRegisterRead = function(params) {
this.result = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes(params[0], params[1]));
this.value = params[2];
}
var _bgResponseGetCounters = function(params) {
this.txok = params[0];
this.txretry = params[1];
this.rxok = params[2];
this.rxfail = params[3];
this.mbuf = params[4];
}
// var _bgResponseGetConnections = function(params) {
// this.maxconn = params[0];
// }
var _bgResponseGetConnections = function(params) {
this.maxconn = params[0];
}
// var _bgResponseReadMemory = function(params) {
// this.address = bitwise.numberFromUint8Bytes(params[0], param[1], params[2], params[3]);
// this.value = params[4];
// }
var _bgResponseReadMemory = function(params) {
this.address = bitwise.numberFromUint8Bytes(params[0], param[1], params[2], params[3]);
this.value = params[4];
}

@@ -51,22 +51,22 @@ var _bgResponseGetInfo = function(params) {

// var _bgResponseEndpointTx = function(params) {
// this.result = bitwise.numberFromUint8Bytes(params[0], params[1]);
// }
var _bgResponseEndpointTx = function(params) {
this.result = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes(params[0], params[1]));
}
// var _bgResponseWhitelistAppend = function(params) {
// this.result = bitwise.numberFromUint8Bytes(params[0], param[1]);
// }
// var _bgResponseWhitelistRemove = function(params) {
// this.result = bitwise.numberFromUint8Bytes(params[0], params[1]);
// }
// var _bgResponseWhitelistClear = function(params) {
var _bgResponseWhitelistAppend = function(params) {
this.result = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes(params[0], params[1]));
}
var _bgResponseWhitelistRemove = function(params) {
this.result = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes(params[0], params[1]));
}
var _bgResponseWhitelistClear = function(params) {
// }
// var _bgResponseEndpointRx = function(params) {
// this.result = bitwise.numberFromUint8Bytes(params[0], param[1]);
// this.size = params[2];
// }
// var _bgResponseSetWatermarks = function(params) {
// this.result = bitwise.numberFromUint8Bytes(params[0], params[1]);
// }
}
var _bgResponseEndpointRx = function(params) {
this.result = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes(params[0], param[1]));
this.size = params[2];
}
var _bgResponseSetWatermarks = function(params) {
this.result = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes(params[0], params[1]));
}

@@ -77,30 +77,31 @@ /***************************************

// var _bgResponsePSDefrag = function(params) {
var _bgResponsePSDefrag = function(params) {
// }
// var _bgResponsePSDump = function(params) {
}
var _bgResponsePSDump = function(params) {
// }
// var _bgResponsePSEraseAll = function(params) {
}
var _bgResponsePSEraseAll = function(params) {
// }
// var _bgResponsePSSave = function(params) {
// this.result = bitwise.numberFromUint8Bytes(params[0], params[1]);
// }
// var _bgResponsePSLoad = function(params) {
// this.result = bitwise.numberFromUint8Bytes(params[0], params[1]);
// }
// var _bgResponsePSErase = function(params) {
// this.result = bitwise.numberFromUint8Bytes(params[0], params[1]);
// }
// var _bgResponsePSErasePase = function(params) {
// this.result = bitwise.numberFromUint8Bytes(params[0], params[1]);
// }
// var _bgResponseWriteWords = function(params) {
}
var _bgResponsePSSave = function(params) {
this.result = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes(params[0], params[1]));
}
var _bgResponsePSLoad = function(params) {
this.result = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes(params[0], params[1]));
this.value = params.splice(2, params.length-2)
}
var _bgResponsePSErase = function(params) {
// }
}
var _bgResponsePSErasePase = function(params) {
this.result = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes(params[0], params[1]));
}
var _bgResponseWriteWords = function(params) {
// /***************************************
// * Attribute Database
// ****************************************/
}
/***************************************
* Attribute Database
****************************************/
var _bgResponseAttributesWrite = function(params) {

@@ -115,13 +116,13 @@ this.result = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes(params[0], params[1]));

}
// var _bgResponseAttributesReadType = function(params) {
// this.handle = bitwise.numberFromUint8Bytes(params[0], params[1]);
// this.result = bitwise.numberFromUint8Bytes(params[2], params[3]);
// this.value = params[4];
// }
// var _bgResponseAttributesUserReadResponse= function(params) {
var _bgResponseAttributesReadType = function(params) {
this.handle = bitwise.numberFromUint8Bytes(params[0], params[1]);
this.result = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes(params[2], params[3]));
this.value = params[4];
}
var _bgResponseAttributesUserReadResponse= function(params) {
// }
// var _bgResponseAttributesUserWriteResponse = function(params) {
}
var _bgResponseAttributesUserWriteResponse = function(params) {
// }
}

@@ -135,29 +136,28 @@ /***************************************

}
// var _bgResponseConnectionGetRSSI = function(params) {
// this.connection = params[0];
// this.rssi = params[1];
// }
// var _bgResponseConnectionUpdate = function(params) {
// this.connection = params[0];
// this.result = bitwise.numberFromUint8Bytes(params[1], params[2]);
// }
// var _bgResponseConnectionChannelMapGet = function(params) {
// this.connection = params[0];
// this.map = params[1];
// }
// var _bgResponseConnectionChannelMapSet = function(params) {
// this.connection = params[0];
// this.result = bitwise.numberFromUint8Bytes(params[1], params[2]);
// }
// var _bgResponseConnectionFeaturesGet = function(params) {
// this.connection = params[0];
// this.result = bitwise.numberFromUint8Bytes(params[1], params[2]);
// }
var _bgResponseConnectionGetRSSI = function(params) {
this.connection = params[0];
this.rssi = params[1];
}
var _bgResponseConnectionUpdate = function(params) {
this.connection = params[0];
this.result = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes(params[1], params[2]));
}
var _bgResponseConnectionChannelMapGet = function(params) {
this.connection = params[0];
this.map = params[1];
}
var _bgResponseConnectionChannelMapSet = function(params) {
this.connection = params[0];
this.result = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes(params[1], params[2]));
}
var _bgResponseConnectionFeaturesGet = function(params) {
this.connection = params[0];
this.result = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes(params[1], params[2]));
}
var _bgResponseConnectionGetStatus = function(params) {
this.connection = params[0];
}
// var _bgResponseConnectionRawTx = function(params) {
// this.connection = params[0];
// }
var _bgResponseConnectionRawTx = function(params) {
this.connection = params[0];
}

@@ -188,6 +188,6 @@ /***************************************

}
// var _bgResponseAttClientAttributeWrite = function(params) {
// this.connection = params[0];
// this.result = bitwise.numberFromUint8Bytes(params[1], params[2]);
// }
var _bgResponseAttClientAttributeWrite = function(params) {
this.connection = params[0];
this.result = bitwise.numberFromUint8Bytes(params[1], params[2]);
}
var _bgResponseAttClientWriteCommand = function(params) {

@@ -197,48 +197,52 @@ this.connection = params[0];

}
// var _bgResponseAttClientIndicateConfirm = function(params) {
// this.connection = bitwise.numberFromUint8Bytes(params[0], params[1]);
// }
// var _bgResponseAttClientReadLong = function(params) {
// this.connection = params[0];
// this.result = bitwise.numberFromUint8Bytes(params[1], params[2]);
// }
// var _bgResponseAttClientPrepareWrite = function(params) {
// this.connection = params[0];
// this.result = bitwise.numberFromUint8Bytes(params[1], params[2]);
// }
// var _bgResponseAttClientExecuteWrite = function(params) {
// this.connection = params[0];
// this.result = bitwise.numberFromUint8Bytes(params[1], params[2]);
// }
// var _bgResponseAttClientReadMultiple = function(params) {
// this.connection = params[0];
// this.result = bitwise.numberFromUint8Bytes(params[1], params[2]);
// }
var _bgResponseAttClientIndicateConfirm = function(params) {
this.connection = bitwise.numberFromUint8Bytes(params[0], params[1]);
}
var _bgResponseAttClientReadLong = function(params) {
this.connection = params[0];
this.result = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes(params[1], params[2]));
}
var _bgResponseAttClientPrepareWrite = function(params) {
this.connection = params[0];
this.result = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes(params[1], params[2]));
}
var _bgResponseAttClientExecuteWrite = function(params) {
this.connection = params[0];
this.result = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes(params[1], params[2]));
}
var _bgResponseAttClientReadMultiple = function(params) {
this.connection = params[0];
this.result = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes(params[1], params[2]));
}
// /***************************************
// * Security Manager
// ****************************************/
// var _bgResponseSMEncryptStart = function(params) {
// this.handle = params[0];
// this.result = bitwise.numberFromUint8Bytes(params[1], params[2]);
// }
// var _bgResponseSMSetBondable = function(params) {
/***************************************
* Security Manager
****************************************/
var _bgResponseSMEncryptStart = function(params) {
this.handle = params[0];
this.result = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes(params[1], params[2]));
}
var _bgResponseSMSetBondable = function(params) {
// }
// var _bgResponseSMDeleteBonding = function(params) {
// this.result = bitwise.numberFromUint8Bytes(params[0], params[1]);
// }
// var _bgResponseSMPasskeyEntry = function(params) {
// this.result = bitwise.numberFromUint8Bytes(params[0], params[1]);
// }
// var _bgResponseSMGetBonds = function(params) {
// this.bonds = params[0];
// }
// var _bgResponseSMSetOOBData = function(params) {
}
var _bgResponseSMDeleteBonding = function(params) {
this.result = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes(params[0], params[1]));
}
var _bgResponseSMPasskeyEntry = function(params) {
this.result = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes(params[0], params[1]));
}
var _bgResponseSMGetBonds = function(params) {
this.bonds = params[0];
}
var _bgResponseSMSetOOBData = function(params) {
// }
}
// /***************************************
// * Generic Access Profile
// ****************************************/
var _bgResponsesSetParameters = function(params) {
}
/***************************************
* Generic Access Profile
****************************************/
var _bgResponseGAPSetPrivacyFlags = function(params) {

@@ -260,18 +264,18 @@

}
// 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 _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) {

@@ -281,90 +285,90 @@ this.result = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes(params[0], params[1]));

// /***************************************
// * Hardware
// ****************************************/
// var _bgResponseHWIOPortConfigIRQ = function(params) {
// this.result = bitwise.numberFromUint8Bytes(params[0], params[1]);
// }
// var _bgResponseHWSetSoftTimer = function(params) {
// this.result = bitwise.numberFromUint8Bytes(params[0], params[1]);
// }
// var _bgResponseHWADCRead = function(params) {
// this.result = bitwise.numberFromUint8Bytes(params[0], params[1]);
// }
// var _bgResponseHWIOPortConfigDirection = function(params) {
// this.result = bitwise.numberFromUint8Bytes(params[0], params[1]);
// }
// var _bgResponseHWIOPortConfigFunction = function(params) {
// this.result = bitwise.numberFromUint8Bytes(params[0], params[1]);
// }
// var _bgResponseHWIOPortConfigPull = function(params) {
// this.result = bitwise.numberFromUint8Bytes(params[0], params[1]);
// }
// var _bgResponseHWIOPortWrite = function(params) {
// this.result = bitwise.numberFromUint8Bytes(params[0], params[1]);
// }
// var _bgResponseHWIOPortRead = function(params) {
// this.result = bitwise.numberFromUint8Bytes(params[0], params[1]);
// this.port = params[2];
// this.data = params[3];
// }
// var _bgResponseHWSPIConfig = function(params) {
// this.result = bitwise.numberFromUint8Bytes(params[0], params[1]);
// }
// var _bgResponseHWIOSPITransfer = function(params) {
// this.result = bitwise.numberFromUint8Bytes(params[0], params[1]);
// this.channel = params[2];
// this.data = params[3];
// }
// var _bgResponseHWI2CRead = function(params) {
// this.result = bitwise.numberFromUint8Bytes(params[0], params[1]);
// this.data = params[2];
// }
// var _bgResponseHWI2CWrite = function(params) {
// this.written = params[0];
// }
// var _bgResponseHWSetTxPower = function(params) {
/***************************************
* Hardware
****************************************/
var _bgResponseHWIOPortConfigIRQ = function(params) {
this.result = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes(params[0], params[1]));
}
var _bgResponseHWSetSoftTimer = function(params) {
this.result = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes(params[0], params[1]));
}
var _bgResponseHWADCRead = function(params) {
this.result = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes(params[0], params[1]));
}
var _bgResponseHWIOPortConfigDirection = function(params) {
this.result = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes(params[0], params[1]));
}
var _bgResponseHWIOPortConfigFunction = function(params) {
this.result = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes(params[0], params[1]));
}
var _bgResponseHWIOPortConfigPull = function(params) {
this.result = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes(params[0], params[1]));
}
var _bgResponseHWIOPortWrite = function(params) {
this.result = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes(params[0], params[1]));
}
var _bgResponseHWIOPortRead = function(params) {
this.result = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes(params[0], params[1]));
this.port = params[2];
this.data = params[3];
}
var _bgResponseHWSPIConfig = function(params) {
this.result = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes(params[0], params[1]));
}
var _bgResponseHWIOSPITransfer = function(params) {
this.result = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes(params[0], params[1]));
this.channel = params[2];
this.data = params[3];
}
var _bgResponseHWI2CRead = function(params) {
this.result = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes(params[0], params[1]));
this.data = params[2];
}
var _bgResponseHWI2CWrite = function(params) {
this.written = params[0];
}
var _bgResponseHWSetTxPower = function(params) {
// }
// var _bgResponseHWTimerComparator = function(params) {
// this.result = bitwise.numberFromUint8Bytes(params[0], params[1]);
// }
}
var _bgResponseHWTimerComparator = function(params) {
this.result = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes(params[0], params[1]));
}
// /***************************************
// * Test
// ****************************************/
// var _bgResponseTestPhyTx = function(params) {
/***************************************
* Test
****************************************/
var _bgResponseTestPhyTx = function(params) {
// }
// var _bgResponseTestPhyRx = function(params) {
}
var _bgResponseTestPhyRx = function(params) {
// }
// var _bgResponseTestPhyEnd = function(params) {
// this.counter = bitwise.numberFromUint8Bytes(params[0], params[1]);
// }
// var _bgResponseTestPhyReset = function(params) {
}
var _bgResponseTestPhyEnd = function(params) {
this.counter = bitwise.numberFromUint8Bytes(params[0], params[1]);
}
var _bgResponseTestPhyReset = function(params) {
// }
// var _bgResponseTestGetChannelMap = function(params) {
// this.channel_map = params[0]
// }
// var _bgResponseTestDebug = function(params) {
// this.output = params[0];
// }
}
var _bgResponseTestGetChannelMap = function(params) {
this.channel_map = params[0]
}
var _bgResponseTestDebug = function(params) {
this.output = params[0];
}
// /***************************************
// * DFU
// ****************************************/
// var _bgResponseDFUReset= function(params) {
/***************************************
* DFU
****************************************/
var _bgResponseDFUReset= function(params) {
// }
// var _bgResponseDFUFlashSetAddress = function(params) {
// this.result = bitwise.numberFromUint8Bytes(params[0], params[1]);
// }
// var _bgResponseDFUFlashUpload = function(params) {
// this.result = bitwise.numberFromUint8Bytes(params[0], params[1]);
// }
// var _bgResponseDFUFlashUploadFinish = function(params) {
// this.result = bitwise.numberFromUint8Bytes(params[0], params[1]);
// }
}
var _bgResponseDFUFlashSetAddress = function(params) {
this.result = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes(params[0], params[1]));
}
var _bgResponseDFUFlashUpload = function(params) {
this.result = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes(params[0], params[1]));
}
var _bgResponseDFUFlashUploadFinish = function(params) {
this.result = errorHandler.getErrorFromCode(bitwise.numberFromUint8Bytes(params[0], params[1]));
}

@@ -378,52 +382,52 @@

// System Repsonses
0 : [_bgResponseReset, _bgResponseHello],//, _bgResponseAddressGet,
// _bgResponseRegisterWrite, _bgResponseRegisterRead,_bgResponseGetCounters,
// _bgResponseGetConnections, _bgResponseReadMemory, _bgResponseGetInfo,
// _bgResponseEndpointTx, _bgResponseWhitelistAppend, _bgResponseWhitelistRemove,
// _bgResponseWhitelistClear, _bgResponseEndpointRx, _bgResponseSetWatermarks],
0 : [_bgResponseReset, _bgResponseHello, _bgResponseAddressGet,
_bgResponseRegisterWrite, _bgResponseRegisterRead,_bgResponseGetCounters,
_bgResponseGetConnections, _bgResponseReadMemory, _bgResponseGetInfo,
_bgResponseEndpointTx, _bgResponseWhitelistAppend, _bgResponseWhitelistRemove,
_bgResponseWhitelistClear, _bgResponseEndpointRx, _bgResponseSetWatermarks],
// // Persistent Store Responses
// 1 : [_bgResponsePSDefrag, _bgResponsePSDump, _bgResponsePSEraseAll,
// _bgResponsePSSave, _bgResponsePSLoad, _bgResponsePSErase,
// _bgResponsePSErasePase, _bgResponseWriteWords],
// Persistent Store Responses
1 : [_bgResponsePSDefrag, _bgResponsePSDump, _bgResponsePSEraseAll,
_bgResponsePSSave, _bgResponsePSLoad, _bgResponsePSErase,
_bgResponsePSErasePase, _bgResponseWriteWords],
// // Attribute Database Responses
2 : [_bgResponseAttributesWrite, _bgResponseAttributesRead],// _bgResponseAttributesReadType],
// _bgResponseAttributesUserReadResponse, _bgResponseAttributesUserWriteResponse],
// Attribute Database Responses
2 : [_bgResponseAttributesWrite, _bgResponseAttributesRead, _bgResponseAttributesReadType,
_bgResponseAttributesUserReadResponse, _bgResponseAttributesUserWriteResponse],
// // Connection Responses
3 : [_bgResponseConnectionDisconnect],//_bgResponseConnectionGetRSSI], //_bgResponseConnectionUpdate,
// _bgResponseConnectionChannelMapGet, _bgResponseConnectionChannelMapSet, _bgResponseConnectionFeaturesGet,
//_bgResponseConnectionGetStatus],// _bgResponseConnectionRawTx],
// Connection Responses
3 : [_bgResponseConnectionDisconnect, _bgResponseConnectionGetRSSI, _bgResponseConnectionUpdate,
_bgResponseConnectionChannelMapGet, _bgResponseConnectionChannelMapSet, _bgResponseConnectionFeaturesGet,
_bgResponseConnectionGetStatus, _bgResponseConnectionRawTx],
// // Attribute Client Responses
// Attribute Client Responses
4 : [_bgResponseAttClientFindByType, _bgResponseAttClientReadByGroupType, _bgResponseAttClientReadByType,
_bgResponseAttClientFindInformation, _bgResponseAttClientReadByHandle], //_bgResponseAttClientAttributeWrite,
// _bgResponseAttClientWriteCommand, _bgResponseAttClientIndicateConfirm, _bgResponseAttClientReadLong,
// _bgResponseAttClientPrepareWrite, _bgResponseAttClientExecuteWrite, _bgResponseAttClientReadMultiple],
_bgResponseAttClientFindInformation, _bgResponseAttClientReadByHandle, _bgResponseAttClientAttributeWrite,
_bgResponseAttClientWriteCommand, _bgResponseAttClientIndicateConfirm, _bgResponseAttClientReadLong,
_bgResponseAttClientPrepareWrite, _bgResponseAttClientExecuteWrite, _bgResponseAttClientReadMultiple],
// // Security Manager Responses
// 5 : [_bgResponseSMEncryptStart, _bgResponseSMSetBondable, _bgResponseSMDeleteBonding,
// _bgResponseSMPasskeyEntry, _bgResponseSMGetBonds, _bgResponseSMSetOOBData],
// Security Manager Responses
5 : [_bgResponseSMEncryptStart, _bgResponseSMSetBondable, _bgResponseSMDeleteBonding,
_bgResponseSMPasskeyEntry, _bgResponseSMGetBonds, _bgResponseSMSetOOBData, _bgResponsesSetParameters],
// // GAP Responses
// GAP Responses
6 : [_bgResponseGAPSetPrivacyFlags, _bgResponseGAPSetMode, _bgResponseGAPDiscover,
_bgResponseGAPConnectDirect, _bgResponseGAPEndProcedure],// _bgResponseGAPConnectSelective],
// _bgResponseGAPSetFiltering, _bgResponseGAPSetScanParameters, _bgResponseGAPSetAdvParameters,
// _bgResponseGAPSetAdvData, _bgResponseGAPSetDirectedConnectableMode],
_bgResponseGAPConnectDirect, _bgResponseGAPEndProcedure, _bgResponseGAPConnectSelective,
_bgResponseGAPSetFiltering, _bgResponseGAPSetScanParameters, _bgResponseGAPSetAdvParameters,
_bgResponseGAPSetAdvData, _bgResponseGAPSetDirectedConnectableMode],
// // Hardware Responses
// 7 : [_bgResponseHWIOPortConfigIRQ, _bgResponseHWSetSoftTimer, _bgResponseHWADCRead,
// _bgResponseHWIOPortConfigDirection, _bgResponseHWIOPortConfigFunction, _bgResponseHWIOPortConfigPull,
// _bgResponseHWIOPortWrite, _bgResponseHWIOPortRead, _bgResponseHWSPIConfig,
// _bgResponseHWIOSPITransfer, _bgResponseHWI2CRead, _bgResponseHWI2CWrite,
// _bgResponseHWSetTxPower, _bgResponseHWTimerComparator],
// Hardware Responses
7 : [_bgResponseHWIOPortConfigIRQ, _bgResponseHWSetSoftTimer, _bgResponseHWADCRead,
_bgResponseHWIOPortConfigDirection, _bgResponseHWIOPortConfigFunction, _bgResponseHWIOPortConfigPull,
_bgResponseHWIOPortWrite, _bgResponseHWIOPortRead, _bgResponseHWSPIConfig,
_bgResponseHWIOSPITransfer, _bgResponseHWI2CRead, _bgResponseHWI2CWrite,
_bgResponseHWSetTxPower, _bgResponseHWTimerComparator],
// // Test Responses
// 8 : [_bgResponseTestPhyTx, _bgResponseTestPhyRx, _bgResponseTestPhyEnd,
// _bgResponseTestPhyReset, _bgResponseTestGetChannelMap, _bgResponseTestDebug],
// Test Responses
8 : [_bgResponseTestPhyTx, _bgResponseTestPhyRx, _bgResponseTestPhyEnd,
_bgResponseTestPhyReset, _bgResponseTestGetChannelMap, _bgResponseTestDebug],
// // DFU Responses
// 9 : [_bgResponseDFUReset, _bgResponseDFUFlashSetAddress, _bgResponseDFUFlashUpload,
// _bgResponseDFUFlashUploadFinish],
// DFU Responses
9 : [_bgResponseDFUReset, _bgResponseDFUFlashSetAddress, _bgResponseDFUFlashUpload,
_bgResponseDFUFlashUploadFinish],
}

@@ -430,0 +434,0 @@

{
"name": "bglib",
"version": "0.0.31",
"version": "0.0.51",
"description": "Create and parse packets for the BlueGiga BLE112 and BLE113",
"main": "bglib.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "./test/test.js"
},
"author": "Jon McKay <jon@technical.io>",
"author": {
"name": "Jon McKay",
"email": "jon@technical.io"
},
"license": "MIT",
"readmeFilename": "README.md",
"directories": {
"example": "examples"
"libs": "libraries"
},

@@ -23,3 +26,6 @@ "keywords": [

"energy"
]
],
"readme": "##BGLib\nBGLib 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.\n\nI still need to replace bitwise functions with Buffers once those are fully functional on Tessel.\n\n##Install\n```\nnpm install bglib\n```\n\n\n##Examples\n\n###Creating a packet\n\n```\nvar bglib = require('bglib');\n\nbglib.getPacket(bglib.api.systemHello); // Returns [0, 0, 0, 1]\n\n// Use Packet Mode if you don't have flow control\n// It adds a length byte to the front of every packet\nbglib.setPacketMode(true);\nbglib.getPacket(bglib.api.systemHello); // Returns [4, 0, 0, 0, 1]\n\nbglib.getPacket(bglib.api.gapDiscover, [1, 0], function(err, response) {\n\tconsole.log(\"Packet: \", response);\n})\n```\n###Parsing Incoming Data\n\n```\nvar bglib = require('bglib');\n\nvar incomingBytes = [ 128, 38, 6, 0, 189, 0, 108, 189, 40, 93, 28, 216, 1, 255, 27, 2, 1, 6, 17, 6, 186, 86, 137, 166, 250, 191, 162, 189, 1, 70, 125, 110, 56, 88, 171, 173, 5, 22, 10, 24, 7, 4];\n\nbglib.parseIncoming(incomingBytes, function(err, parsedPackets) {\n\tconsole.log(\"Parsed packets: \", parsedPackets);\n\n\t// BGLib will automatically parse each packet into the values stated by the datasheet\n\t// depending on what type of event/response it is. Below is an example for the discovered\n\t// peripheral event that was passed in:\n\tconsole.log(parsedPackets[0].packet_type) // 0\n\tconsole.log(parsedPackets[0].sender) // [ 108, 189, 40, 93, 28, 216 ]\n\tconsole.log(parsedPackets[0].address_type) // 1\n\tconsole.log(parsedPackets[0].bond) // 255\n\tconsole.log(parsedPackets[0].data) // [ 27, 2, 1, 6, 17, 6, 186, 86, 137, 166, 250, 191, 162, 189, 1, 70, 125, 110, 56, 88, 171, 173, 5, 22, 10, 24, 7, 4 ]\n\tconsole.log(parsedPackets[0].rssi) // -100\n});\n```\n\nThe 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.\n\n###Thanks\nJRowberg deserves a special shout-out. Some of the code is modeled after [his Arduino bglib work](https://github.com/jrowberg/bglib).\n",
"_id": "bglib@0.0.5",
"_from": "bglib@0.0.5"
}

@@ -0,1 +1,55 @@

##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 = require('bglib');
bglib.getPacket(bglib.api.systemHello); // Returns [0, 0, 0, 1]
// Use Packet Mode if you don't have flow control
// It adds a length byte to the front of every packet
bglib.setPacketMode(true);
bglib.getPacket(bglib.api.systemHello); // Returns [4, 0, 0, 0, 1]
bglib.getPacket(bglib.api.gapDiscover, [1, 0], function(err, response) {
console.log("Packet: ", response);
})
```
###Parsing Incoming Data
```
var bglib = require('bglib');
var incomingBytes = [ 128, 38, 6, 0, 189, 0, 108, 189, 40, 93, 28, 216, 1, 255, 27, 2, 1, 6, 17, 6, 186, 86, 137, 166, 250, 191, 162, 189, 1, 70, 125, 110, 56, 88, 171, 173, 5, 22, 10, 24, 7, 4];
bglib.parseIncoming(incomingBytes, function(err, parsedPackets) {
console.log("Parsed packets: ", parsedPackets);
// BGLib will automatically parse each packet into the values stated by the datasheet
// depending on what type of event/response it is. Below is an example for the discovered
// peripheral event that was passed in:
console.log(parsedPackets[0].packet_type) // 0
console.log(parsedPackets[0].sender) // [ 108, 189, 40, 93, 28, 216 ]
console.log(parsedPackets[0].address_type) // 1
console.log(parsedPackets[0].bond) // 255
console.log(parsedPackets[0].data) // [ 27, 2, 1, 6, 17, 6, 186, 86, 137, 166, 250, 191, 162, 189, 1, 70, 125, 110, 56, 88, 171, 173, 5, 22, 10, 24, 7, 4 ]
console.log(parsedPackets[0].rssi) // -100
});
```
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).
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc