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. |
Members
actStep :Step
the steppers fix and mob coordinates obtained from the accelerometer readings.
Type:
- Step
commandC_UUID :string
Characteristic UUID for sending commands to server.
Type:
- string
deviceName :string
Server device name.
Type:
- string
logHTML :Object
HTML element whose innerHTML attribute receives the communication logs.
Type:
- Object
mainS_UUID :string
The single service for all device's characteristics.
Type:
- string
maxChunk :number
1 byte array maximum size to be sent to the server.
Type:
- number
OPT :Object
Execution options to ESP32 server.
Type:
- Object
pathC_UUID :string
Characteristic UUID for the parsedPath transmission.
Type:
- string
statusC_UUID :string
Characteristic UUID for measuring ESP32 status.
Type:
- string
steppersC_UUID :string
Characteristic UUID for measuring the steppers position.
Type:
- string
unsafeHTML :Object
HTML element to indicate unsafe mode operation.
Type:
- Object
Methods
disconnectMsg(errorMsg)
Sends an Alert informing disconnection with server.
Parameters:
Name | Type | Description |
---|---|---|
errorMsg |
string | to be displayed with the disconnected message. |
(async) getStatus()
Check status from server and emits alert message for safe and correct use.
Returns:
true if it receives status from ESP32 sever, false otherwise.
(async) goLaser()
Switchs the laser status on/off in the ESP32 server.
(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. |
(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. |
(async) readActSteps()
Read the steppers fix and mob coordinates in the ESP32 server.
(async) sendCommand(optValue)
Sends a this.Opt item to Horus ESP32 Server.
Parameters:
Name | Type | Description |
---|---|---|
optValue |
number | A valid this.Opt item value. |
(async) setZenith()
Set actual steppers step values to ESP32.STEP_AT_ZENITH.
(async) startComm() → {boolean}
Starts bluetooth communication with Horus ESP32 server.
Returns:
connection status.
- Type
- boolean
time()
Actual time for log display.
Returns:
actual time in the format: hours minutes seconds.