Good Day everyone,
I am stucked again with my project.
I have our own C written program code which is communicating with a third party C++ written program code to run a moving device.
We have successfully communicated with the third party code with wrapper functions. (Thanks to member in LQ that helped me solved this.)
Now, we tried to run some functions to move the device. I think it is better for me to attach the related code first.
pro.c (The source code we used to run the device)
int main ( )
pro = PROconnectToDevice((char*) "192.168.1.87" );
printf("\nDevice Connected, Return Code = %d\n", pro);
pro = PROinitializeAndCalibrate ();
printf("\nDevice Initialized and Calibrated, Return Code = %d\n",pro);
pro = PROtakeTool(1);
printf("\nDevice Take Tool, Return Code = %d\n", pro);
printf("\nDevice Disconnected, Return Code = %d\n", pro);
wrapper.cpp (Source code needed to communicate between C and C++ code)
int libInit ( void )
w = new ProjectApplication;
int PROinitializeAndCalibrate ( void )
int PROtakeTool ( unsigned int PROtool )
unsigned int tool;
tool = PROtool;
return w->takeTool( tool );
int PROconnectToDevice( char* PROipAddr )
ipAddr = PROipAddr;
return w->connectToDevice( ipAddr );
void PROdisconnectDevice( void )
void libClose ( void )
After debugging, we will run "./pro".
The device is successfully connected and moved according to the statement in "initializeAndCalibrate ()" and return no error. Then, it turns to "takeTool(1)". The function did called successfully, we also get a return value of 0 that means no error. But, the device not moving at all. The device then disconnect straight away and exiting the routine of "main()".
The execution of statement in routine "main()" pause a while after it call "initializeAndCalibrate ()" until the device finish the movement before it execute the next statement.
After that, no more. Other statements just run so fast and it exit the program with all the statements it executed returned no error.
We are confirmed that there is no problem with the hardware that is the device and the third party software as we test run it before using other test tool and it works well.
We have been finding around for all possible causes for this problem but we just can't get the right one.
Hoping there is someone that can give us some ideas.
Thank you very much.