From Shenzhen XRC Tech Co.,Ltd.

WindowsSdk: register_event set interface

1. int _stdcall register_camera_event(int camera, CAMERA_EVENT event, unsigned int message, HWND hwnd, long * wnd_data, DWORD thread_id, long * thread_data, EVENT_CALLBACK_FUNC callback);
2. int _stdcall register_client_event(void* client, CLIENT_EVENT event, unsigned int message, HWND hwnd, long * wnd_data, DWORD thread_id, long * thread_data, EVENT_CALLBACK_FUNC callback);
3. int _stdcall register_global_event(GLOBAL_EVENT event, unsigned int message, HWND hwnd, DWORD thread_id, EVENT_CALLBACK_FUNC callback);
camera:[in],The camera's handle which is form new_camera
client:[in],The client's object which is from new_client
event:[in],The event which want to register
message:[in],The message from rc_ipcam to user when the event occur
hwnd:[in],The window's handle to receive message when the event occur
wnd_data:[in],The custom data point which is related to hwnd
thread_id:[in],The id of thread which to receive message when the event occur
thread_data:[in],The custom data point which is related to thread_id
callback:[in],This callback function will be called when the event occur
>= 0:Success, is the event id
< 0:Fail, refer to the definition of error number
The registration of a camera event of interest.

    Users by registering a camera success, can register for this camera event of interest,
So that when the user is interested in the event of the camera, through the set by the user before way to inform the user.
The rc_ipcam library to notify users in three ways: to the message, the user specified window to send the message to the user specified server, Callback user specified callback function. The user can be one or more of them at the same time setting,
HWnd, thread_id, callback three parameters corresponding to the three kinds of mode, when NULL, said not to use the way of representative, or use.

    If the user use the window message or thread message mode, when the user is interested in after the incident,
Rc_ipcam to the specified window or send the message specified by the user thread. Message number is specified by the message parameter,At the same time, along with the message and two standard with the message parameters, message parameter meaning according to the event will be different,

    See description below. In addition the message parameter set by the user the best > WM_USER, 
in order to avoid conflict and system message.

    If the user uses a callback method, when the user is interested in after the incident, 
rc_ipcam callback function is called the user specified.

    The message parameter of the message callback function is equal to the parameter of the function, while the two message parameter callback function in WParam, lParam meaning according to the event will be different, as shown in the following description. In addition on the callback functions, the need to pay attention to two points:

1.rc_ipcam calls the callback function context and customers are calling this function context is different, 
because of different threads, so the user must ensure thread safety in the callback function.Don't realize 
2 callback function in any block processing, otherwise it will block the rc_ipcam Library of internal thread, 
which will influence the efficiency of the rc_ipcam library. 

CAMERA_STATUS_CHANGED

ParameterExplain
wParamThe client's object
lParamThe point to CAMERA_STATUS_CHANGED_PARAM structure, user must call free_memory to free this memory。

VIDEO_STATUS_CHANGED

ParameterExplain
wParamThe client's object
lParamThe point to PLAY_STATUS_CHANGED_PARAM structure, user must call free_memory to free this memory。

AUDIO_STATUS_CHANGED

ParameterExplain
wParamThe client's object
lParamThe point to PLAY_STATUS_CHANGED_PARAM structure, user must call free_memory to free this memory。

SPEAK_STATUS_CHANGED

ParameterExplain
wParamThe client's object
lParamThe point to PLAY_STATUS_CHANGED_PARAM structure, user must call free_memory to free this memory。

VIDEO_DATA

ParameterExplain
wParamThe client's object
lParamThe point to VIDEO_FRAME structure, user must call free_video to free this memory。

AUDIO_DATA

ParameterExplain
wParamThe client's object
lParamThe point to AUDIO_CHUNK structure, user must call free_audio to free this memory。

CLIENT_VIDEO_STATISTIC

ParameterExplain
wParamThe client's object
lParamType of int, means the window relate to client which is showing video, how many frame is showed per second.

MONITORED_STATUS_CHANGED

ParameterExplain
wParamThe Camera's handle
lParamThe point to type char,means the camera's status changed, user can caller parse_status to parse the status name and value which changed. User must call free_memory to free this memory。

CAMERA_STATISTIC

ParameterExplain
wParamThe Camera's handle
lParamThe point to CAMERA_STATISTICS structure, user must call free_memory to free this memory。

CAMERAS_SEARCH

ParameterExplain
wParamSEARCH_RESULT类型,表示事件的子类型
lParamThe point to CAMERA_SEARCH_INFO, user must call free_memory to free this memory

DISK_SPACK_WARNING

ParameterExplain
wParamChar type, means the driver of disk
lParamInt type, means the driver have how much MB free sapce.

RECORD_COMPLETE

ParameterExplain
wParamThe point to type char, means camera's ID. user must call free_memory to free this memory.
lParamThe point to type char, means record file's path. user must call free_memory to free this memory.
If the user use the window message or thread message mode, 
when the VIDEO_DATA event occurs, rc_ipcam video data 
will be received by sending a message to the user program. 
Because the video decoding and display may consume a large amount of CPU resources, 
may cause the transmission speed of the user the video data processing speed behind the rc_ipcam, 
resulting in real time and memory overhead video playback of continuous growth. 
So the message window message or thread under the VIDEO_DATA event, 
we define the parameters of two pointer types in this function: wnd_data and thread_data. 
You should define a variable of type long corresponding, 
and began to play before the image will be initialized to 0, 
if the user sets wnd_data and thread_data is not equal to NULL, 
then rc_ipcam in each send a VIDEO_DATA event related news, 
will use the InterlockedIncrement function will be increased by 1, 
while the user receives the corresponding message, 
you should use the InterlockedDecrement function to minus 1,
 so that the user can be informed of the current number of messages in the message queue is not to handle the VIDEO_DATA event corresponding, and adopt corresponding measures, 
such as receiving not decode display processing, 
to maintain the cost of the system in a stable state. 
If the user sets wnd_data and thread_data is equal to NULL, 
the corresponding work is rc_ipcam library will not do.
Retrieved from http://wiki.reecam.cn/WindowsSdk/InterfaceRegisterEvent
Page last modified on April 11, 2013, at 03:42 PM EST