Constructor
new MiniDroneBtAdapter(options)
Instantiates a new instance of the MiniDroneBtAdapter class
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
options |
Object | Configuration options object
Properties
|
- Source:
Methods
createBuffer(uuid, args) → {buffer}
Creates a buffer with the common values needed to write to the drone
Parameters:
Name | Type | Description |
---|---|---|
uuid |
String | The characteristic UUID |
args |
Array | The buffer arguments, usually the above command constants |
- Source:
Returns:
A freshly created Buffer stream
- Type
- buffer
getCharacteristic(uuid) → {Characteristic}
Finds a Noble Characteristic class for the given characteristic UUID
Parameters:
Name | Type | Description |
---|---|---|
uuid |
String | The characteristics UUID |
- Source:
Returns:
The Noble Characteristic corresponding to that UUID
- Type
- Characteristic
onBatteryStatusChange(data, isNotification) → {undefined}
Event handler for when the drone broadcasts a batter status change
Parameters:
Name | Type | Description |
---|---|---|
data |
Object | he event data |
isNotification |
Boolean | If the broadcast event is a notification |
- Source:
Returns:
- Type
- undefined
onDisconnect() → {undefined}
Event handler for when noble disconnect from a peripheral
Set connected state to false and start scanning
- Source:
Returns:
- Type
- undefined
onFlightStatusChange(data, isNotification) → {undefined}
Event handler for when the drone broadcasts a flight status change
Parameters:
Name | Type | Description |
---|---|---|
data |
Object | The event data |
isNotification |
Boolean | If the broadcast event is a notification |
- Source:
Returns:
- Type
- undefined
onNobleStateChange(state) → {undefined}
Event handler for when noble broadcasts a state change
Parameters:
Name | Type | Description |
---|---|---|
state |
String | a string describing noble's state |
- Source:
Returns:
- Type
- undefined
onPeripheralDiscovery(peripheral) → {undefined}
Event handler for when noble discovers a peripheral
Validates it is a drone and attempts to connect.
Parameters:
Name | Type | Description |
---|---|---|
peripheral |
Peripheral | a noble peripheral class |
- Source:
Returns:
- Type
- undefined
setupPeripheral() → {undefined}
Sets up a peripheral and finds all of it's services and characteristics
- Source:
Returns:
- Type
- undefined
updateRssi()
Updates Rssi to get signal strength
- Source:
validatePeripheral(peripheral) → {boolean}
Validates a noble Peripheral class is a Parrot MiniDrone
Parameters:
Name | Type | Description |
---|---|---|
peripheral |
Peripheral | a noble peripheral object class |
- Source:
Returns:
If the peripheral is a drone
- Type
- boolean
write(uuid, buffer) → {undefined}
Writes a buffer to a BTLE peripheral characteristic
Most convince methods in this class point to this method
Parameters:
Name | Type | Description |
---|---|---|
uuid |
String | the characteristic's UUID |
buffer |
Buffer | stream of binary data |
- Source:
Returns:
- Type
- undefined
writeAnimation(animation) → {undefined}
Convenience method for writing animation class methods
Parameters:
Name | Type | Description |
---|---|---|
animation |
String | The animation direction |
- Source:
Returns:
- Type
- undefined
writeEmergency() → {undefined}
Convenience method for writing the emergency command
- Source:
Returns:
- Type
- undefined
writeFlightParams(flightParams) → {undefined}
Writes the drones roll, pitch, yaw and altitude to the device
TODO: This could be smarter and cache values and only update when changed
Parameters:
Name | Type | Description |
---|---|---|
flightParams |
object | Object containing any roll, pitch, yaw and altitude |
- Source:
Returns:
- Type
- undefined
writeLand() → {undefined}
Convenience method for writing the land command
- Source:
Returns:
- Type
- undefined
writeMaxAltitude(altitude) → {undefined}
Convenience method for setting the drone's altitude limitation
Parameters:
Name | Type | Description |
---|---|---|
altitude |
Integer | the altitude in meters (2m-10m for Airborne Cargo / 2m - 25m for Mambo) |
- Source:
Returns:
- Type
- undefined
writeMaxRotationSpeed(tilt) → {undefined}
Convenience method for setting the drone's max rotation speed limitation
Parameters:
Name | Type | Description |
---|---|---|
tilt |
integer | The max rotation speed from (50°-360° for Airborne Cargo / 50° - 180° for Mambo) |
- Source:
Returns:
- Type
- undefined
writeMaxTilt(tilt) → {undefined}
Convenience method for setting the drone's max tilt limitation
Parameters:
Name | Type | Description |
---|---|---|
tilt |
integer | The max tilt from 0-100 (0 = 5° - 100 = 20°) |
- Source:
Returns:
- Type
- undefined
writeMaxVerticalSpeed(verticalSpeed) → {undefined}
Convenience method for setting the drone's max vertical speed limitation
Parameters:
Name | Type | Description |
---|---|---|
verticalSpeed |
integer | The max vertical speed from 0.5m/s - 2m/s |
- Source:
Returns:
- Type
- undefined
writeTakeoff() → {undefined}
Convenience method for writing the takeoff command
- Source:
Returns:
- Type
- undefined
writeTakePicture() → {undefined}
Convenience method for writing the media take a picture command
- Source:
Returns:
- Type
- undefined
writeTrim() → {undefined}
Convenience method for writing the flat trim command
- Source:
Returns:
- Type
- undefined