LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

how to call function pointer SetCompStatusCallBack(void ((*CompStatusCallBack)(int id, int status, unsigned char conflict))) by LabWindows/CVI

This is our customer provide DLL  H file.
//=======================================================
// This head file should be added into the project which
// will call Tigris RTF.dll
//=======================================================
int __stdcall CloseTigrisDll (void);
int __stdcall OpenTigrisDll (void);
int __stdcall InitializeCOM (int ComNum);
int __stdcall PowerOnOff (int OnOff);
//int __stdcall GetFinisherVer (unsigned char *MajorVersion, unsigned char *MinorVersion);
int __stdcall GetFinisherVer (void);
int __stdcall TurnComponentOn (unsigned short ComponentId);
int __stdcall TurnComponentOff (unsigned short ComponentId);
int __stdcall InitializeFinisher (void);
//int __stdcall GetComponentStatus (unsigned short ComponentId, unsigned char *Status);
int __stdcall GetComponentStatus (unsigned short ComponentId);
int __stdcall GetDLLVersion (void);
//int __stdcall CheckRxTx (void);
int __stdcall GetFinisherStatus (int status[50]);
     /*
     "Finisher top cover (SW120) open",      //0
     "Finisher not available",          //1
     "Rear booklet stapler (SW63) low on staples",  //2
     "Front booklet stapler (SW64) low on staples",   //3
     "Top tray full",         //4
     "Main tray full",           //5
     "Finisher paused due to pause switch",      //6
     "S110 jam",           //7
     "Jam in upper path of finisher",      //8
     "Jam in lower path of finisher",     //9
     "Purge sheets sent to top tray",       //10
     "Purge sheets sent to main tray",        //11
     "Purge sheets sent to bottom tray",        //12
     "Main tray is unavailable",          //13
     "Main stapler out of staples, or cartridge out",    //14
     "Main stapler low on staples",         //15
     "Front door (SW01) open",          //16
     "Bottom tray is unavailable",         //17
     "Rear booklet stapler out of staples",       //18
     "Front booklet stapler out of staples",       //19
     "Bottom tray (booklet) stapler is unavailable",     //20
     "Bottom tray full",            //21
     "Bottom tray not empty",          //22
     "Main Stapler is unavailable",         //23
     "Main tray offsetting is unavailable",       //24
     "Stapler interlock (SW04) is open",        //25
     "Booklet stapler interlock (SW64) is open",      //26
     "Jam in Finisher Area 5",       //27
     "Jam in Finisher area 1a",       //28
     "Jam in Finisher area 1b",       //29
     "Jam in Finisher area 1a and 1b",     //30
     "Close Finisher front left door",     //31
     };
     */
void __stdcall SetCompStatusCallBack(void ((*CompStatusCallBack)(int id, int status, unsigned char conflict)));
void __stdcall SetFaultCodeCallBack(void ((*FaultCodeCallBack)(unsigned char chain, int link, unsigned char extension)));
void __stdcall SetMffStatusCallBack(void ((*FinisherStatusCallBack)(int id, unsigned char status)));
 
 
It should be write by LabWindows/CVI.
I try to call this function by LabWindows/CVI but can not compile.
 
Void SetCompStatusCallBack(void ((*CompStatusCallBack)(int id, int status, unsigned char conflict)))

 

Sets up callback function for getting component status.

 

Parameters:

* CompStatusCallback – entry point for callback function.

 

Return Value:

         None

 

Below I use  CVI  write simple source,  CompStatusCallBack no  prototype define at dll head file

 

#include <utility.h>
#include <tigrisComDLL.h>
void main()
{
  int errornum=0;
  int ver;
  int id;
  int status;
  unsigned char conflict;
  errornum=OpenTigrisDll ();
  errornum=InitializeCOM(1);
  Delay(1);
  errornum=PowerOnOff(1);  
  Delay(1);
  errornum=PowerOnOff(1);
  ver=GetFinisherVer();
  SetCompStatusCallBack(void ((*CompStatusCallBack)(id, status, conflict)));
  errornum=TurnComponentOn(1088);
  Delay(1);  
  errornum=GetComponentStatus(1088);
  errornum=PowerOnOff(0);
  CloseTigrisDll();
}

0 Kudos
Message 1 of 3
(3,024 Views)

The usual arrangement when such callback facilities are provided is for the user to write the callback function, which is then called by the library under defined circumstances, such as a hardware event occuring or a change in status being detected. You can then have your user function do whatever you consider appropriate. Maybe you should contact your supplier for details and example code.

JR

0 Kudos
Message 3 of 3
(3,017 Views)