Class: Bluetooth

Basic.Comm.Bluetooth(logHTML, unsafeHTML)

Communication via Low Energy Bluetooth with the Horus ESP32 server.

Constructor

new Bluetooth(logHTML, unsafeHTML)

Creates a bluetooth connection.
Parameters:
Name Type Description
logHTML * HTML element whose innerHTML attribute receives the communication logs.
unsafeHTML * HTML element to indicate when in the unsafe mode.
Source:

Members

actStep :Step

the steppers fix and mob coordinates obtained from the accelerometer readings.
Type:
  • Step
Source:

commandC_UUID :string

Characteristic UUID for sending commands to server.
Type:
  • string
Source:

deviceName :string

Server device name.
Type:
  • string
Source:

logHTML :Object

HTML element whose innerHTML attribute receives the communication logs.
Type:
  • Object
Source:

mainS_UUID :string

The single service for all device's characteristics.
Type:
  • string
Source:

maxChunk :number

1 byte array maximum size to be sent to the server.
Type:
  • number
Source:

OPT :Object

Execution options to ESP32 server.
Type:
  • Object
Source:

pathC_UUID :string

Characteristic UUID for the parsedPath transmission.
Type:
  • string
Source:

statusC_UUID :string

Characteristic UUID for measuring ESP32 status.
Type:
  • string
Source:

steppersC_UUID :string

Characteristic UUID for measuring the steppers position.
Type:
  • string
Source:

unsafeHTML :Object

HTML element to indicate unsafe mode operation.
Type:
  • Object
Source:

Methods

disconnectMsg(errorMsg)

Sends an Alert informing disconnection with server.
Parameters:
Name Type Description
errorMsg string to be displayed with the disconnected message.
Source:

(async) getStatus()

Check status from server and emits alert message for safe and correct use.
Source:
Returns:
true if it receives status from ESP32 sever, false otherwise.

(async) goLaser()

Switchs the laser status on/off in the ESP32 server.
Source:

(async) goPath(Path, cyclicOpt)

Executes a parsedPath on steppers in the ESP32 server.
Parameters:
Name Type Default Description
Path CommPath Path to be executed by the ESP32 server steppers.
cyclicOpt string single 'single': path is executed once; 'forward': path is excuted cyclically forward until stop signal; 'alternate': path is excuted cyclically alternate until stop signal.
Source:

(async) goStepSize(stepSize, dirs)

Executes a step size on steppers in the Horus ESP32 server.
Parameters:
Name Type Description
stepSize number Step size between 1 and 128.
dirs string String in the format 'xab', where x is any alphabetic character, a and b control the fixed and mobile steppers, respectively, and each one can assume the characters: '0' = move backward, '1' = stay still, and '2' = move forward.
Source:

(async) readActSteps()

Read the steppers fix and mob coordinates in the ESP32 server.
Source:

(async) sendCommand(optValue)

Sends a this.Opt item to Horus ESP32 Server.
Parameters:
Name Type Description
optValue number A valid this.Opt item value.
Source:

(async) setZenith()

Set actual steppers step values to ESP32.STEP_AT_ZENITH.
Source:

(async) startComm() → {boolean}

Starts bluetooth communication with Horus ESP32 server.
Source:
Returns:
connection status.
Type
boolean

time()

Actual time for log display.
Source:
Returns:
actual time in the format: hours minutes seconds.