Bluetooth Component
  • 06 Dec 2023
  • 1 Minute to read
  • Contributors
  • Dark
    Light
  • PDF

Bluetooth Component

  • Dark
    Light
  • PDF

Article summary

The EdgeReady platform allows the EdgeReady Apps to connect to Bluetooth devices through the bluetooth component. The logic for this connection can be implemented using the following blocks:

BTDeviceGetList

This block retrieves the list of bluetooth devices that are available nearby. It has two callback functions:

  • The Discovered list function retrieves the available devices in the range
  • The Disappeared list function retrieves the devices that has gone out of range
InputOutputBlock LayoutGenerated Code
Table VariableReturns the list of available devicesBluetooth-getdevice
async function er_2a628d77_29ff_41fd_8186_def49c423fa8_onPageShow(e,obj,index){
   await __er.getDeviceList(async function(list){

  },
  async function(list){

  });

}

BTPairDevice

This block enables device pairing based on device ID

InputOutputBlock LayoutGenerated Code
Variable (device ID)Pairs device based on device IDpairdevice
async function er_1698131203_click(e,obj,index){
   await __er.pairDevice(obj,async function(){

  },
  async function(err){

  });

}

BTUnPairDevice

This block enables unpairing of device based on device ID.

InputOutputBlock LayoutGenerated Code
Variable (device ID)UnPairs device based on device IDunpairdevice
async function er_1698131203_click(e,obj,index){
   await __er.unPairDevice("",async function(){

  },
  async function(err){

  });

}

BTConnectDevice

This block connects to a specific bluetooth device based on device ID.

InputOutputBlock LayoutGenerated Code
Variable (device ID)Connects to a device based on device IDconnectdevice
async function er_1698139457_click(e,obj,index){
   await __er.connect((await __er.getState("deviceID")),async function(){

  },
  async function(err){

  });

}

BTDisconnectDevice

This block disconnects from a specific bluetooth device based on device ID.

InputOutputBlock LayoutGenerated Code
Variable (device ID)Disconnects a device based on device IDdisconnectdevice
async function er_1698139457_click(e,obj,index){
   await __er.disconnect((await __er.getState("deviceID")),async function(){

  },
  async function(err){

  });

}

BTListenDevice

This block is used to receive the data from the connected bluetooth device. 

InputOutputBlock LayoutGenerated Code
Variable (device ID)Object (receives the data returned by the Bluetooth device)listendevice
async function er_1698139457_click(e,obj,index){
   await __er.listen("",async function(obj){

  });

}

BTCommandDevice

This block sends commands to a bluetooth device based on device ID. For example, if a printer is the bluetooth device, this block sends the data that is to be printed. 

InputOutputBlock LayoutGenerated Code
Variable (device ID)
commanddevice
async function er_1698139457_click(e,obj,index){
   await __er.command("","",async function(){

  },
  async function(err){

  });

}


Was this article helpful?

ESC

Eddy AI, facilitating knowledge discovery through conversational intelligence