Using Dronekit Android, I'm listening to events in onDroneEvent. One of those events is AttributeEvent.PARAMETER_RECEIVED
I'm able to get other attributes, like attitude, battery, signal rssi, etc. Just don't know how to get access to the parameters sent from the drone after connecting.
public void onDroneEvent(String event, Bundle extras) {
switch (event) {
case AttributeEvent.PARAMETER_RECEIVED:
//Grab extra parameter data
//possibly using AttributeEventExtra.EXTRA_PARAMETER_NAME
// AttributeEventExtra.EXTRA_PARAMETER_INDEX
// AttributeEventExtra.EXTRA_PARAMETER_VALUE
break;
. . . removed extraneous code . . .
Any pointers would be appreciated.
You can take a look a how this is done in the Parameter screen in Tower for reference.
In general, parameters from the drone are sent after connection, or after an explicit call to VehicleApi#refreshParameters().
To monitor when they are being refreshed, you can listen for the PARAMETERS_REFRESH_STARTED and PARAMETERS_REFRESH_COMPLETED events. Between these two events, several PARAMETER_RECEIVED events will also be sent for each parameter that's updated.
You can also access the last retrieved set of parameters using:
Parameters parameters = drone.getAttribute(AttributeType.PARAMETERS);