Init and Exit Processing

Init and exit processing are common processing that are necessary for all programming.
Init processing is performed by function ZmInit.
This function creates driver file and secures necessary memory.

There are 2 parameters in function ZmInit.
The first parameter is DeviceName.
DeviceName is a character string such as "ZM000" which is registered in Setup Tool (configuration).

The second parameter is ID.
ID is a number passed from driver, and this ID is required to use the following functions.

If function terminates normally, the return value (Ret) is 0.
If function execution failed, a value other than 0 is returned.

Exit processing is performed by function ZmExit.
This function stops the device and driver operation, releases all the resources used by memory and threads, etc.
Please make sure to execute this function before terminating application.
Otherwise, the resources used by driver may remain unopened.

Programming Examples for each Language

Perform init and exit processing for device "ZM000".

 

Programming Example in C

long Ret;
short Id;

 

Ret = ZmInit( "ZM000" , &Id );
if(Ret != 0){
   printf("Error occurred in ZmInit %d\n", Ret);
}

 

Ret = ZmExit( Id );
if(Ret != 0){
   printf("Error occurred in ZmExit %d\n", Ret);
}

 

Programming Example in Python

Ret = ctypes.c_long()

Id = ctypes.c_short()

 

Ret.value = czm.ZmInit ( b"ZM000" , ctypes.byref(Id))

if Ret.value != 0:

    print(f"Error occurred in ZmInit {Ret.value}\n")

 

Ret.value = czm.ZmExit ( Id )

if Ret.value != 0:

    print(f"Error occurred in ZmExit {Ret.value}\n")