【In troduction】
- The third party payload includes speakers, spotlights, parachutes etc. The MSDK V5 encapsulates the speaker into IMegaphoneManager class. This article will introduce the how to use the megaphone and the communication with PSDK/OSDK.
【Megaphone】
【Communication with PSDK】
- The versions prior to MSDK 5.2 do not include the PayloadManager for unified management of communication with PSDK devices. As a result, it is necessary to use the PayloadKey to perform operations.
1. How to use PayloadKey
-
- You can use KeyPayloadType to get the type of the gimbal connector such as Skyport 1, Skyport 2 and X-Port.
- You can use KeyPayloadProductName to get the name of payload, it is defined in the PSDK code.
- You can use KeyIsPayloadProductReady to know if the connection betwwen payload and aircraft is normal.
- You can use KeyUploadBandwidthLimit to know the channel bandwidth of MSDK to PSDK.
- You can use KeyDataFloatHintMsgFromPayload to know the HintMessage sent from payload to the MSDK. It is similar to the setMessageCallback in MSDK V4.
- You can setup a listener for KeyDataFromPayload to receive the byte array data sent from payload to MSDK. It is similar to the setCommandDataCallback in MSDK V4. You can use performAction method to operate the KeySendDataToPayload to send data to the payload. It is similar to the sendDataToPayload in MSDK V4.
- If you want to configure the PayloadWidget, please read How to configure the PayloadWidget?
- In order to find other PayloadKeys, you need to search "PayloadKey" globally in the project and find what it is inherited from. It is inherited from the co_s package and it contains all PayloadKeys. Their usage are all similar to the MSDK V4.
- All PayloadKey hasn't been fully tested now, some of them may be unavailable.
- Please use PSDK V3.0 or above version, the OSDK decice such as Manifold will be treated as an PSDK device. Any devices that connect to the original OSDK srial port need to use the onBoardKey to operate them.
2.How to use PayloadManager
- With PayloadCenter, you can obtain the PayloadManager for different expansion positions of the aircraft to communicate with the corresponding PSDK program.
- In the window components set by PSDK, the TextInputBoxWidget is implemented through data transmission, so it cannot be set its value through setWidgetValue.
【MOP function】
- Starting from version 5.3, MSDK now includes the PipelineManager to centrally manage MOP functionality. For versions prior to 5.3, you can refer to the usage instructions of PipelineIdentifier.
1. How to use PipelineIdentifier
-
- Currently only M300 supports MOP function, you need to call our internal method wihout any API doc.
- Coonect to pipeline. In v4, you only need to input id. In v5 you need to use PipelineIdentifier. Its third parameter is either PAYLOAD or ONBOARD. The forth parameter is id. The other parameters can be set to 0.
var mPipelineIdentifier = PipelineIdentifier(0, 0, PipelineDeviceType.PAYLOAD, 49152, 0)
PipelinesManager.connectPipeline(mPipelineIdentifier, TransmissionControlType.STABLE - Disconnect the pipeline, same as connect.
PipelinesManager.disconnectPipeline(mPipelineIdentifier)
- Write data, the same as v4 but the first parameter is PipelineIdentifier and the second parameter is the byte array you want to pass.
PipelinesManager.writeData(mPipelineIdentifier, data)
- Read data, the same as v4.
PipelinesManager.readData(mPipelineIdentifier, data)
- the MSDK V5 DEMO currently does not utilize the PipelineIdentifier. You can only refer to the MOP demo in MSDK v4.
2.How to use PipelineManager
-
- connectPipeline:To establish a channel connection. It requires the ID of the channel, the type of the device, and the type of the channel to be passed in. The type of the device refers to the type of the mounting port, where ONBOARD represents the expansion port above the body, which is only used on M300 and M350.
- disconnectPipeline:To disconnect the channel, it requires the same parameters as establishing a connection.
- After the channel is successfully connected, you can obtain the corresponding Pipeline object for receiving and sending data. Use readData to receive data and writeData to send data. Please note that the data transmission is limited by the actual bandwidth of the channel. For more details, please refer to the documentation of PSDK.:channel bandwidth
- DEMO:https://github.com/dji-sdk/Mobile-SDK-Android-V5/blob/dev-sdk-main/SampleCode-V5/android-sdk-v5-sample/module-aircraft/src/main/java/dji/sampleV5/moduleaircraft/pages/MOPCenterFragment.kt
Comments
1 comment
Hello William Wong
I‘m working with the new MSDK V5 and try to make use of the IMegaphoneManager to send a AudioFile to the Speaker (pushFileToMegaphone). This works fine with recorded File, which are recorded via the RC but it doesn‘t work for other audio files. How can I use other audio files to be used in the class pushFileToMegaphone?
Please sign in to leave a comment.