 |
NOTE : This project is not currently in development and is totally unsupported. These pages are here for information only.
getNumberofPics
Declaration
extern "C" status_t getNumberofPics(int &);
Description
This function must be implemented in the plugin. This function accepts a single int
which should be set to the number of images there are in the camera available for download.
The function returns a status_t error code to indicate the success of the
operation. Any of the status_t error codes can be used, but it is suggested that
you stick to using B_NO_ERROR for success and B_ERROR for failure.
Example Implementation - Kodak DC210 Plugin
status_t getNumberofPics(int &number)
{
//Number of bytes per packet
int len = 256;
unsigned char *buffer = new unsigned char[256];
//Ask the camera for it's status information, from which we
//can obtain the number of images in the camera
ComPort->Write("\x7F\x00\x00\x00\x00\x00\x00\x1A",8);
ComPort->Read(buffer,1);
while (buffer[0] == 0xf0)
ComPort->Read(buffer,1);
if (buffer[0] == 0xe2)
return(B_ERROR);
else if (buffer[0] == 0xd1)
{
ComPort->Read(buffer,1);
//Read in a packet of data from the camera
receivepacket(buffer,len, true);
number = (buffer[56] << 8) + buffer[57];
ComPort->Read(buffer,1);
while (buffer[0] == 0xf0)
ComPort->Read(buffer,1); //Check for busy byte
if (buffer[0] == 0x00)
{
snooze(50000);
return(B_NO_ERROR);
}
else
return(B_ERROR);
}
else
return(B_ERROR);
}
BDCP Developers Home Page
|
|
 |
|