Skip to content

Commit

Permalink
Added ClearCacheRPLIDAR()
Browse files Browse the repository at this point in the history
  • Loading branch information
lebarsfa committed Jan 26, 2021
1 parent e4512bc commit 1910013
Show file tree
Hide file tree
Showing 13 changed files with 48 additions and 13 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/github-actions.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
on: [push, pull_request]
on:
push:
branches: '**'
tags: '' # Restrict to blank tags
pull_request:
jobs:
# This job can be removed if a new release should not be created...
deploy:
Expand Down
2 changes: 2 additions & 0 deletions ClearCacheRPLIDAR.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
function [result] = ClearCacheRPLIDAR(pRPLIDAR)
result = calllib('hardwarex', 'ClearCacheRPLIDARx', pRPLIDAR);
16 changes: 8 additions & 8 deletions MDM.h
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ inline int SendDataMDM(MDM* pMDM, uint8* buf, int buflen, int* pSentBytes)
printf("SendDataMDM error (%s) : %s"
"(pMDM=%#x)\n",
strtime_m(),
"Error sending data with the device. ",
"Error sending data with a MDM. ",
(unsigned int)(intptr_t)pMDM);
return EXIT_FAILURE;
}
Expand Down Expand Up @@ -296,7 +296,7 @@ inline int RecvDataMDM(MDM* pMDM, uint8* buf, int buflen, int* pReceivedBytes)
printf("RecvDataMDM error (%s) : %s"
"(pMDM=%#x)\n",
strtime_m(),
"Error receiving data with the device. ",
"Error receiving data with a MDM. ",
(unsigned int)(intptr_t)pMDM);
return EXIT_FAILURE;
}
Expand Down Expand Up @@ -332,7 +332,7 @@ inline int PurgeDataMDM(MDM* pMDM)
printf("PurgeDataMDM error (%s) : %s"
"(pMDM=%#x)\n",
strtime_m(),
"Error purging data from the device. ",
"Error purging data from a MDM. ",
(unsigned int)(intptr_t)pMDM);
return EXIT_FAILURE;
}
Expand Down Expand Up @@ -371,7 +371,7 @@ inline int SendAllDataMDM(MDM* pMDM, uint8* buf, int buflen)
printf("SendAllDataMDM error (%s) : %s"
"(pMDM=%#x)\n",
strtime_m(),
"Error sending data with the device. ",
"Error sending data with a MDM. ",
(unsigned int)(intptr_t)pMDM);
return EXIT_FAILURE;
}
Expand Down Expand Up @@ -426,7 +426,7 @@ inline int RecvAllDataMDM(MDM* pMDM, uint8* buf, int buflen)
printf("RecvAllDataMDM error (%s) : %s"
"(pMDM=%#x)\n",
strtime_m(),
"Error receiving data with the device. ",
"Error receiving data with a MDM. ",
(unsigned int)(intptr_t)pMDM);
return EXIT_FAILURE;
}
Expand Down Expand Up @@ -499,7 +499,7 @@ inline int SendDataCRC16MDM(MDM* pMDM, uint8* buf, int buflen)
printf("SendDataCRC16MDM error (%s) : %s"
"(pMDM=%#x)\n",
strtime_m(),
"Error sending data with the device. ",
"Error sending data with a MDM. ",
(unsigned int)(intptr_t)pMDM);
free(writebuf);
return EXIT_FAILURE;
Expand Down Expand Up @@ -572,7 +572,7 @@ inline int RecvDataCRC16MDM(MDM* pMDM, uint8* buf, int buflen)
printf("RecvDataCRC16MDM error (%s) : %s"
"(pMDM=%#x)\n",
strtime_m(),
"Error receiving data with the device. ",
"Error receiving data with a MDM. ",
(unsigned int)(intptr_t)pMDM);
free(readbuf);
return EXIT_FAILURE;
Expand Down Expand Up @@ -641,7 +641,7 @@ inline int EchoByteMDM(MDM* pMDM, uint8* pb)
printf("EchoMDM error (%s) : %s"
"(pMDM=%#x)\n",
strtime_m(),
"Error sending data with the device. ",
"Error sending data with a MDM. ",
(unsigned int)(intptr_t)pMDM);
return EXIT_FAILURE;
}
Expand Down
23 changes: 21 additions & 2 deletions RPLIDAR.h
Original file line number Diff line number Diff line change
Expand Up @@ -666,20 +666,39 @@ inline int GetStartupMessageRPLIDAR(RPLIDAR* pRPLIDAR)

if (PurgeRS232Port(&pRPLIDAR->RS232Port) != EXIT_SUCCESS)
{
printf("Warning : A RPLIDAR might not be responding correctly. \n");
printf("Error purging data from a RPLIDAR. \n");
return EXIT_FAILURE;
}
// Need to purge twice on Mac OS otherwise next read() would fail...?
if (PurgeRS232Port(&pRPLIDAR->RS232Port) != EXIT_SUCCESS)
{
printf("Warning : A RPLIDAR might not be responding correctly. \n");
printf("Error purging data from a RPLIDAR. \n");
return EXIT_FAILURE;
}
#endif // ENABLE_RPLIDAR_SDK_SUPPORT

return EXIT_SUCCESS;
}

inline int ClearCacheRPLIDAR(RPLIDAR* pRPLIDAR)
{
#ifdef ENABLE_RPLIDAR_SDK_SUPPORT
if (IS_FAIL(pRPLIDAR->drv->clearNetSerialRxCache()))
{
printf("A RPLIDAR is not responding correctly : clearNetSerialRxCache() failed. \n");
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
#else
if (PurgeRS232Port(&pRPLIDAR->RS232Port) != EXIT_SUCCESS)
{
printf("Error purging data from a RPLIDAR. \n");
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
#endif // ENABLE_RPLIDAR_SDK_SUPPORT
}

inline int GetHealthRequestRPLIDAR(RPLIDAR* pRPLIDAR, BOOL* pbProtectionStop)
{
#ifdef ENABLE_RPLIDAR_SDK_SUPPORT
Expand Down
5 changes: 5 additions & 0 deletions hardwarex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1245,6 +1245,11 @@ HARDWAREX_API int GetStartupMessageRPLIDARx(RPLIDAR* pRPLIDAR)
return GetStartupMessageRPLIDAR(pRPLIDAR);
}

HARDWAREX_API int ClearCacheRPLIDARx(RPLIDAR* pRPLIDAR)
{
return ClearCacheRPLIDAR(pRPLIDAR);
}

HARDWAREX_API int GetHealthRequestRPLIDARx(RPLIDAR* pRPLIDAR, BOOL* pbProtectionStop)
{
return GetHealthRequestRPLIDAR(pRPLIDAR, pbProtectionStop);
Expand Down
1 change: 1 addition & 0 deletions hardwarex.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ extern "C" {
HARDWAREX_API int StopRequestRPLIDARx(RPLIDAR* pRPLIDAR);
HARDWAREX_API int ResetRequestRPLIDARx(RPLIDAR* pRPLIDAR);
HARDWAREX_API int GetStartupMessageRPLIDARx(RPLIDAR* pRPLIDAR);
HARDWAREX_API int ClearCacheRPLIDARx(RPLIDAR* pRPLIDAR);
HARDWAREX_API int GetHealthRequestRPLIDARx(RPLIDAR* pRPLIDAR, BOOL* pbProtectionStop);
HARDWAREX_API int GetInfoRequestRPLIDARx(RPLIDAR* pRPLIDAR, int* pModelID, int* pHardwareVersion, int* pFirmwareMajor, int* pFirmwareMinor, char* SerialNumber);
HARDWAREX_API int GetTypicalScanModeRPLIDARx(RPLIDAR* pRPLIDAR, int* pScanModeID);
Expand Down
Binary file modified linux_x64/hardwarex.so
Binary file not shown.
Binary file modified mac/hardwarex.dylib
Binary file not shown.
Binary file modified x64/hardwarex.dll
Binary file not shown.
4 changes: 3 additions & 1 deletion x64/hardwarex_proto.m
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
function [methodinfo,structs,enuminfo,ThunkLibName]=hardwarex_proto
%HARDWAREX_PROTO Create structures to define interfaces found in 'hardwarex'.

%This function was generated by loadlibrary.m parser version on Mon Jan 18 21:30:36 2021
%This function was generated by loadlibrary.m parser version on Tue Jan 26 19:41:04 2021
%perl options:'hardwarex.i -outfile=hardwarex_proto.m -thunkfile=hardwarex_thunk_pcwin64.c -header=hardwarex.h'
ival={cell(1,0)}; % change 0 to the actual number of functions to preallocate the data.
structs=[];enuminfo=[];fcnNum=1;
Expand Down Expand Up @@ -258,6 +258,8 @@
fcns.thunkname{fcnNum}='int32voidPtrThunk';fcns.name{fcnNum}='ResetRequestRPLIDARx'; fcns.calltype{fcnNum}='Thunk'; fcns.LHS{fcnNum}='int32'; fcns.RHS{fcnNum}={'RPLIDARPtr'};fcnNum=fcnNum+1;
% int GetStartupMessageRPLIDARx ( RPLIDAR * pRPLIDAR );
fcns.thunkname{fcnNum}='int32voidPtrThunk';fcns.name{fcnNum}='GetStartupMessageRPLIDARx'; fcns.calltype{fcnNum}='Thunk'; fcns.LHS{fcnNum}='int32'; fcns.RHS{fcnNum}={'RPLIDARPtr'};fcnNum=fcnNum+1;
% int ClearCacheRPLIDARx ( RPLIDAR * pRPLIDAR );
fcns.thunkname{fcnNum}='int32voidPtrThunk';fcns.name{fcnNum}='ClearCacheRPLIDARx'; fcns.calltype{fcnNum}='Thunk'; fcns.LHS{fcnNum}='int32'; fcns.RHS{fcnNum}={'RPLIDARPtr'};fcnNum=fcnNum+1;
% int GetHealthRequestRPLIDARx ( RPLIDAR * pRPLIDAR , BOOL * pbProtectionStop );
fcns.thunkname{fcnNum}='int32voidPtrvoidPtrThunk';fcns.name{fcnNum}='GetHealthRequestRPLIDARx'; fcns.calltype{fcnNum}='Thunk'; fcns.LHS{fcnNum}='int32'; fcns.RHS{fcnNum}={'RPLIDARPtr', 'int32Ptr'};fcnNum=fcnNum+1;
% int GetInfoRequestRPLIDARx ( RPLIDAR * pRPLIDAR , int * pModelID , int * pHardwareVersion , int * pFirmwareMajor , int * pFirmwareMinor , char * SerialNumber );
Expand Down
Binary file modified x64/hardwarex_thunk_pcwin64.dll
Binary file not shown.
Binary file modified x86/hardwarex.dll
Binary file not shown.
4 changes: 3 additions & 1 deletion x86/hardwarex_proto.m
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
function [methodinfo,structs,enuminfo,ThunkLibName]=hardwarex_proto
%HARDWAREX_PROTO Create structures to define interfaces found in 'hardwarex'.

%This function was generated by loadlibrary.m parser version on Mon Jan 18 21:30:17 2021
%This function was generated by loadlibrary.m parser version on Tue Jan 26 19:40:46 2021
%perl options:'hardwarex.i -outfile=hardwarex_proto.m'
ival={cell(1,0)}; % change 0 to the actual number of functions to preallocate the data.
structs=[];enuminfo=[];fcnNum=1;
Expand Down Expand Up @@ -257,6 +257,8 @@
fcns.name{fcnNum}='ResetRequestRPLIDARx'; fcns.calltype{fcnNum}='cdecl'; fcns.LHS{fcnNum}='int32'; fcns.RHS{fcnNum}={'RPLIDARPtr'};fcnNum=fcnNum+1;
% int GetStartupMessageRPLIDARx ( RPLIDAR * pRPLIDAR );
fcns.name{fcnNum}='GetStartupMessageRPLIDARx'; fcns.calltype{fcnNum}='cdecl'; fcns.LHS{fcnNum}='int32'; fcns.RHS{fcnNum}={'RPLIDARPtr'};fcnNum=fcnNum+1;
% int ClearCacheRPLIDARx ( RPLIDAR * pRPLIDAR );
fcns.name{fcnNum}='ClearCacheRPLIDARx'; fcns.calltype{fcnNum}='cdecl'; fcns.LHS{fcnNum}='int32'; fcns.RHS{fcnNum}={'RPLIDARPtr'};fcnNum=fcnNum+1;
% int GetHealthRequestRPLIDARx ( RPLIDAR * pRPLIDAR , BOOL * pbProtectionStop );
fcns.name{fcnNum}='GetHealthRequestRPLIDARx'; fcns.calltype{fcnNum}='cdecl'; fcns.LHS{fcnNum}='int32'; fcns.RHS{fcnNum}={'RPLIDARPtr', 'int32Ptr'};fcnNum=fcnNum+1;
% int GetInfoRequestRPLIDARx ( RPLIDAR * pRPLIDAR , int * pModelID , int * pHardwareVersion , int * pFirmwareMajor , int * pFirmwareMinor , char * SerialNumber );
Expand Down

0 comments on commit 1910013

Please sign in to comment.