AioSetTmCallBackProc


Function

Registers the called callback function as an event relative to interval timer occurs.

Format

Ret = AioSetTmCallBackProc ( Id , TimerId , CallBackProc , AiEvent , Param)

Parameters

Id [ VB.NET: Short ] [ C, C++ : short ] [ C# : short ] [ Python : ctypes.c_short ]
Specifies the device ID retrieved from AioInit.

TimerId [ VB.NET : Short ] [ C, C++ : short ] [ C# : short ] [ Python : ctypes.c_short ]
Specifies the timer ID.

CallBackProc [ VB.NET: IntPtr ] [ C, C++ : long * ] [ C# : IntPtr ] [ Python : ctypes.POINTER(ctypes.c_long) ]
Specifies the address of the callback function.

TmEvent [ VB.NET: Integer ] [ C, C++ : long ] [ C# : int ] [ Python : ctypes.c_long ]
The event factor that invoke the callback function is specified from the following range in the macro or numerical value.
AiEvent has the following meanings in bit, it can be specified by a combination of these bits.

Event factor

Macro

Value

Event that interval elapses

TME_INT

00000001H

Param [ VB.NET: IntPtr ] [ C, C++ : void * ] [ C# : void * ] [ Python : ctypes.c_void_p ]
Specifies the address of parameter passed to callback.
If the parameter isn't needed, please set NULL to it.

Return value

Ret [ VB.NET : Integer ] [ C, C++ : long ] [ C# : int ] [ Python : ctypes.c_long ]

Return values

Content

0

Normality completion

7

Execute AioResetDevice function because the device has recovered from standby mode

10001

Invalid Id was specified
Use the Id retrieved from AioInit to specify the Id in this function.

10002

AIO driver can't be called
At first, perform AioInit function.

16020

The value of TimerId is outside the designated range of the function

20001

This function can't be used by this device

20002

Can not use while by another device works
To use this function, timer operation must be stopped.

20003

Can not use because another process is using the device
When another process is using the device, all functions except for those that support multi-process can not be performed.

26020

The value of TimerId is outside the designated range of the device being used

Remarks

This function is used to register the callback function, if any event occurs on device, the callback function will be called.
The operation of callback function is similar to event, callback does not need the window handle, therefore the callback can be used for the application without window.

This function cannot be used on devices without timer functionality.
If the device is in operation, the function cannot be performed.
It cannot be used with window message notification (AioSetTmEvent).

If the function AioStopTmTimer is performed, the callback function cannot be called.

You should not execute the functions that start/stop devices operation in the callback routine.

Example

Registers the callback function with the factor of Event that interval elapses.

VB.NET

Please refer to [Note of Using Visual Basic .NET]
 

C, C++

long Ret;
Ret = AioSetTmCallBackProc ( Id , 0 , CallBackProc , TME_INT , this );
 

C#

Please refer to [Note of Using Visual C#]
 

Python

Ret = ctypes.c_long()
Ret.value = caio.AioSetTmCallBackProc ( Id , 0 , CallBackProc , caio.TME_INT , 0 )
 



Callback function

Format

Ret = CallBackProc ( Id , Message , wParam , lParam , Param )

Parameters

Id [ VB.NET: Short ] [ C, C++ : short ] [ C# : short ] [ Python : ctypes.c_short ]
The ID retrieved from AioInit is passed.

Message [ VB.NET: Short ] [ C, C++ : short ] [ C# : short ] [ Python : ctypes.c_short ]
The message ID that cause the invoked callback function is passed.
Message ID is one of the following values.

Analog input message factor

Macro

Value

Interval are satisfied event

AIOM_TME_INT

1060H

wParam [ VB.NET: Integer ] [ C, C++ : WPARAM ] [ C# : int ] [ Python : ctypes.wintypes.WPARAM ]
The value of TimerId is passed.

lParam [ VB.NET: Integer ] [ C, C++ : LPARAM ] [ C# : int ] [ Python : ctypes.wintypes.LPARAM ]
The parameter peculiar to event is passed.

Event factor

Parameter

Event that interval elapses

None

Param [ VB.NET: IntPtr ] [ C, C++ : void * ] [ C# : void * ] [ Python : ctypes.c_void_p ]
The parameter specified in AioSetTmCallBackProc is passed.
If the parameter is specified to NULL, NULL is stored here.