rlx:点击遥控器时通过udp发送点击坐标;
This commit is contained in:
@ -119,6 +119,13 @@ static uint32_t s_tapZoomNewestTargetHybridFocalLength = 0; // unit: 0.1mm
|
||||
static T_DjiMutexHandle s_tapZoomMutex = NULL;
|
||||
static E_DjiCameraVideoStreamType s_cameraVideoStreamType;
|
||||
|
||||
static int sockfd;
|
||||
static struct sockaddr_in server;
|
||||
static struct sockaddr_in client;
|
||||
static socklen_t addrlen;
|
||||
|
||||
char s_positionMessage[100]=" ";
|
||||
|
||||
/* Private functions declaration ---------------------------------------------*/
|
||||
//用于s_commonHandler中的回调函数:相机类基础功能
|
||||
static T_DjiReturnCode GetSystemState(T_DjiCameraSystemState *systemState);
|
||||
@ -587,6 +594,9 @@ static T_DjiReturnCode SetFocusTarget(T_DjiCameraPointInScreen target)
|
||||
USER_LOG_INFO("set focus target x:%.2f y:%.2f", target.focusX, target.focusY);
|
||||
memcpy(&s_cameraFocusTarget, &target, sizeof(T_DjiCameraPointInScreen));
|
||||
|
||||
sprintf(s_positionMessage, "%.2f,%.2f", target.focusX, target.focusY);
|
||||
sendto(sockfd, s_positionMessage, strlen(s_positionMessage), 0, (struct sockaddr *)&server, sizeof(server));
|
||||
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
@ -1399,6 +1409,15 @@ T_DjiReturnCode DjiTest_CameraEmuBaseStartService(void)
|
||||
|
||||
s_isCamInited = true;
|
||||
|
||||
// 创建UDP套接字
|
||||
if ((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) == -1) {
|
||||
perror("Creatingsocket failed.");
|
||||
}
|
||||
bzero(&server, sizeof(server));
|
||||
server.sin_family = AF_INET;
|
||||
server.sin_port = htons(POSITION_PORT_RLX);
|
||||
server.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -31,6 +31,13 @@
|
||||
#include "dji_typedef.h"
|
||||
#include "dji_payload_camera.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
|
||||
#define POSITION_PORT_RLX 20005
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user