Sambar Server WebCam

The Sambar Server includes a WebCam module that can be used to take pictures. The source code for the WebCam module can be found in samples/source/webcam.c. This WebCam module uses Microsoft's Video for Windows to interact with the camera. Any camera that supports this standard should be compatible with the webcam_snapshot RPC.

To enable the webcam functionality, you must first install the WebCam module via the config/config.ini file.

INIT = samples.dll:webcam_init

Once initialized, the System Administrator can take a camera snapshot picture using the Sambar Server RPC:

<RCXwebcam_snapshot outfile=c:/sambar42/docs/picture.jpg>

The above RPC takes a picture and writes the output to the file specified in the outfile argument.

Automatic Pictures

The server can be programmed to automatically take pictures by adding an entry in the config/scheduler.ini instructing the server to process a Sambar Script page with the webcam_snapshot RPC embedded in it. For example, the following entry will take a webcam snapshot every 5 minutes:

[cron]
5 * * * * = /session/url2file?fname=/docs/index.htm&url=/takepic.stm

The above cron entry results in the URL takepic.stm being executed every 5 minutes; the output of the URL request is written to the index.htm file in the docs directory. The following is a sample takepic.stm file:

<HTML>
<BODY>
<H1>Welcome to Brian-Cam</H1>
<BR>
<BR>
<RCXwebcam_snapshot outfile=c:/sambar42/sysimage/brian.jpg>
<IMG SRC=/sysimage/brian.jpg>
<BR>
Last update: <RCEdatetime>
</BODY>
</HTML>