When Moduware API is ready start listening for received data
document.addEventListener('WebViewApiReady',function(){Moduware.v0.API.Module.addEventListener('DataReceived',function(event){// we don't care about data not related to our moduleif(event.moduleUuid!=Moduware.Arguments.uuid)return;// ... handle specific received data here ...});});
State Change Response
if(event.dataSource=='StateChangeResponse'){// ... work with data variables here ...}
Data Name
Message Type
StateChangeResponse
2701
Response to state change command
Variables
switch(event.variables.result){case'success':// ... handle the state here ...break;case'failure':// ... handle the state here ...break;}
Name
Title
Description
States
result
Result
Result of connect or disconnect request
success / failure
Status Request Response
if(event.dataSource=='StatusRequestResponse'){// ... work with data variables here ...}
Data Name
Message Type
StatusRequestResponse
2703
Response to status request
Variables
switch(event.variables.status){case'disconnected':// ... handle the state here ...break;case'connected':// ... handle the state here ...break;}
switch(event.variables.defaultState){case'disconnected':// ... handle the state here ...break;case'connected':// ... handle the state here ...break;}
Name
Title
Description
States
status
Status
Indicates if module is turned on or not
disconnected / connected
defaultState
Default State
Indicates default state for module when it is connected
disconnected / connected
Bluetooth Name Request Response
if(event.dataSource=='BluetoothNameRequestResponse'){// ... work with data variables here ...}
Data Name
Message Type
BluetoothNameRequestResponse
2705
Response to request of bluetooth name of speaker module
Variables
console.log(event.variables.bluetoothName);
Name
Title
Description
States
bluetoothName
Bluetooth Name
-
*
Default State Change Request Response
if(event.dataSource=='DefaultStateChangeRequestResponse'){// ... work with data variables here ...}
Data Name
Message Type
DefaultStateChangeRequestResponse
2707
Response to request of configuring new default state
Variables
switch(event.variables.result){case'success':// ... handle the state here ...break;case'failure':// ... handle the state here ...break;}