NEW: release DJI Payload-SDK version 3.5
Signed-off-by: DJI-Martin <DJI-Martin@dji.com>
This commit is contained in:
@ -98,6 +98,10 @@ T_DjiReturnCode Osal_MutexCreate(T_DjiMutexHandle *mutex)
|
||||
{
|
||||
int result;
|
||||
|
||||
if (!mutex) {
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
*mutex = malloc(sizeof(pthread_mutex_t));
|
||||
if (*mutex == NULL) {
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_MEMORY_ALLOC_FAILED;
|
||||
@ -118,7 +122,11 @@ T_DjiReturnCode Osal_MutexCreate(T_DjiMutexHandle *mutex)
|
||||
*/
|
||||
T_DjiReturnCode Osal_MutexDestroy(T_DjiMutexHandle mutex)
|
||||
{
|
||||
int result;
|
||||
int result = 0;
|
||||
|
||||
if (!mutex) {
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
result = pthread_mutex_destroy(mutex);
|
||||
if (result != 0) {
|
||||
@ -136,8 +144,13 @@ T_DjiReturnCode Osal_MutexDestroy(T_DjiMutexHandle mutex)
|
||||
*/
|
||||
T_DjiReturnCode Osal_MutexLock(T_DjiMutexHandle mutex)
|
||||
{
|
||||
int result = pthread_mutex_lock(mutex);
|
||||
int result = 0;
|
||||
|
||||
if (!mutex) {
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
result = pthread_mutex_lock(mutex);
|
||||
if (result != 0) {
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||
}
|
||||
@ -152,8 +165,13 @@ T_DjiReturnCode Osal_MutexLock(T_DjiMutexHandle mutex)
|
||||
*/
|
||||
T_DjiReturnCode Osal_MutexUnlock(T_DjiMutexHandle mutex)
|
||||
{
|
||||
int result = pthread_mutex_unlock(mutex);
|
||||
int result = 0;
|
||||
|
||||
if (!mutex) {
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
result = pthread_mutex_unlock(mutex);
|
||||
if (result != 0) {
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||
}
|
||||
@ -308,6 +326,14 @@ T_DjiReturnCode Osal_GetTimeUs(uint64_t *us)
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
T_DjiReturnCode Osal_GetRandomNum(uint16_t *randomNum)
|
||||
{
|
||||
srand(time(NULL));
|
||||
*randomNum = random() % 65535;
|
||||
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
void *Osal_Malloc(uint32_t size)
|
||||
{
|
||||
return malloc(size);
|
||||
|
@ -63,6 +63,7 @@ T_DjiReturnCode Osal_SemaphorePost(T_DjiSemaHandle semaphore);
|
||||
|
||||
T_DjiReturnCode Osal_GetTimeMs(uint32_t *ms);
|
||||
T_DjiReturnCode Osal_GetTimeUs(uint64_t *us);
|
||||
T_DjiReturnCode Osal_GetRandomNum(uint16_t *randomNum);
|
||||
|
||||
void *Osal_Malloc(uint32_t size);
|
||||
void Osal_Free(void *ptr);
|
||||
|
@ -46,7 +46,7 @@ typedef struct {
|
||||
T_DjiReturnCode Osal_Socket(E_DjiSocketMode mode, T_DjiSocketHandle *socketHandle)
|
||||
{
|
||||
T_SocketHandleStruct *socketHandleStruct;
|
||||
socklen_t optlen = sizeof(int);
|
||||
socklen_t optlen = sizeof (int);
|
||||
int rcvBufSize = SOCKET_RECV_BUF_MAX_SIZE;
|
||||
int opt = 1;
|
||||
|
||||
@ -72,7 +72,8 @@ T_DjiReturnCode Osal_Socket(E_DjiSocketMode mode, T_DjiSocketHandle *socketHandl
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (setsockopt(socketHandleStruct->socketFd, SOL_SOCKET, SO_RCVBUF, &rcvBufSize, optlen) < 0) {
|
||||
if (setsockopt(socketHandleStruct->socketFd, SOL_SOCKET, SO_RCVBUF, &rcvBufSize, optlen) < 0)
|
||||
{
|
||||
goto out;
|
||||
}
|
||||
} else if (mode == DJI_SOCKET_MODE_TCP) {
|
||||
|
Reference in New Issue
Block a user