void Test_Pro_Link(void) { unsigned char buf[16]; ProSendParameter param; const char key[32] = {"this is key"}; //set the communication Pro_Config_Comm_Encrypt_Key(key); //session 0 buf[0] = 0x11; buf[1] = 0x22; param.pkg_type = 0; param.length = 2; param.buf = buf; param.need_encrypt = 1; Pro_Send_Interface(¶m); //session 1 buf[0] = 0x33; buf[1] = 0x44; param.pkg_type = 1; param.length = 2; param.ack_callback = Test_ACK_Callback; param.buf = buf; param.need_encrypt = 1; Pro_Send_Interface(¶m); //session 2~31 buf[0] = 0x55; buf[1] = 0x66; param.pkg_type = 2; param.length = 2; param.ack_timeout = 1000; //unit is ms param.ack_callback = Test_ACK_Callback; param.retry_time = 1; param.buf = buf; param.need_encrypt = 1; Pro_Send_Interface(¶m); //session 2~31 buf[0] = 0x77; buf[1] = 0x88; param.pkg_type = 2; param.length = 2; param.ack_timeout = 1000; //unit is ms param.ack_callback = Test_ACK_Callback; param.retry_time = 1; param.buf = buf; param.need_encrypt = 1; Pro_Send_Interface(¶m); }
void App_Send_Data(unsigned char flag, uint8_t is_enc, unsigned char cmd_set, unsigned char cmd_id,unsigned char *pdata,int len,ACK_Callback_Func ack_callback, int timeout ,int n) { ProSendParameter param; unsigned char *ptemp = (unsigned char *)Pro_Encode_Data; *ptemp++ = cmd_set; *ptemp++ = cmd_id; memcpy(Pro_Encode_Data + SET_CMD_SIZE,pdata,len); param.ack_callback = ack_callback; param.pkg_type = flag; param.length = len + SET_CMD_SIZE; param.buf = Pro_Encode_Data; param.retry_time = n; param.ack_timeout = timeout; param.need_encrypt = is_enc; Pro_Send_Interface(¶m); }
void DJI_Pro_App_Send_Data(unsigned char session_mode, unsigned char is_enc, unsigned char cmd_set, unsigned char cmd_id, unsigned char *pdata,int len,ACK_Callback_Func ack_callback, int timeout ,int retry_time) { ProSendParameter param; unsigned char *ptemp = (unsigned char *)Pro_Encode_Data; *ptemp++ = cmd_set; *ptemp++ = cmd_id; memcpy(Pro_Encode_Data + SET_CMD_SIZE,pdata,len); param.ack_callback = ack_callback; param.session_mode = session_mode; param.length = len + SET_CMD_SIZE; param.buf = Pro_Encode_Data; param.retry_time = retry_time; param.ack_timeout = timeout; param.need_encrypt = is_enc; Pro_Send_Interface(¶m); }