Page 225 - PDA Robotics Using Your Personal Digital Assistant to Control Your Robot
P. 225
PDA 10 5/27/03 8:51 AM Page 201
Chapter 10 / The PDA Robotics Command Center
//
if( ( same_count < trigger_threshold ) && ( frames_sampled >= 4 ) )
{
detected_motion = TRUE;
//
// Stop the streaming and grab a frame
//
capCaptureAbort(h_capwin);
capGrabFrame(h_capwin);
initialized = 0;
//
// TODO: ENSURE no mem leakage
//
AfxGetMainWnd()->SetTimer(CLEAR_MOTION_DETECT ,50, NULL);
return TRUE;
}
else
{
detected_motion = FALSE;
}
//
// Save the last frame
//
memcpy( last_frame_data, frame_data, lpVHdr->dwBytesUsed );
free(frame_data);
return TRUE;
}
When motion is detected, the program will save an image and forward
it via FTP or SMTP (mail).
Sending Data Using FTP
class CFtp
{
public:
CFtp();
~CFtp();
201