KallistiOS  ##version##
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
Data Structures | Macros | Typedefs | Functions
dreameye.h File Reference

Definitions for using the Dreameye Camera device. More...

#include <sys/cdefs.h>
#include <arch/types.h>
#include <dc/maple.h>

Go to the source code of this file.

Data Structures

struct  dreameye_state
 Dreameye status structure. More...
 

Macros

#define DREAMEYE_GETCOND_NUM_IMAGES   0x81
 Get the number of images on the device. More...
 
#define DREAMEYE_GETCOND_TRANSFER_COUNT   0x83
 Get the number of transfers to copy an image. More...
 
#define DREAMEYE_SUBCOMMAND_IMAGEREQ   0x04
 Get an image from the device. More...
 
#define DREAMEYE_SUBCOMMAND_ERASE   0x05
 Erase an image from the device. More...
 
#define DREAMEYE_SUBCOMMAND_ERROR   0xFF
 Error return command. More...
 
#define DREAMEYE_IMAGEREQ_CONTINUE   0x00
 Continue transferring an image. More...
 
#define DREAMEYE_IMAGEREQ_START   0x40
 Start transferring an image from its start. More...
 

Typedefs

typedef struct dreameye_state dreameye_state_t
 Dreameye status structure. More...
 

Functions

int dreameye_get_image_count (maple_device_t *dev, int block)
 Get the number of images on the Dreameye. More...
 
int dreameye_get_image (maple_device_t *dev, uint8 image, uint8 **data, int *img_sz)
 Transfer an image from the Dreameye. More...
 
int dreameye_erase_image (maple_device_t *dev, uint8 image, int block)
 Erase an image from the Dreameye. More...
 

Detailed Description

Definitions for using the Dreameye Camera device.

This file contains the definitions needed to access the Maple Camera type device (aka, the Dreameye). Currently, this driver allows you to download the still pictures that are saved on the camera and delete them. It does not allow you to use the camera for video input currently.

Author
Lawrence Sebald

Macro Definition Documentation

#define DREAMEYE_GETCOND_NUM_IMAGES   0x81

Get the number of images on the device.

This constant is used with the MAPLE_COMMAND_GETCOND command to fetch the number of images on the device.

#define DREAMEYE_GETCOND_TRANSFER_COUNT   0x83

Get the number of transfers to copy an image.

This constant is used with the MAPLE_COMMAND_GETCOND command to fetch the number of times a transfer command must be sent to get the image specified.

#define DREAMEYE_IMAGEREQ_CONTINUE   0x00

Continue transferring an image.

#define DREAMEYE_IMAGEREQ_START   0x40

Start transferring an image from its start.

#define DREAMEYE_SUBCOMMAND_ERASE   0x05

Erase an image from the device.

This subcommand is used with the MAPLE_COMMAND_CAMCONTROL command to remove an image from the device.

#define DREAMEYE_SUBCOMMAND_ERROR   0xFF

Error return command.

This subcommand is used by the dreameye with the MAPLE_COMMAND_CAMCONTROL command to indicate an error occurred in a subcommand.

#define DREAMEYE_SUBCOMMAND_IMAGEREQ   0x04

Get an image from the device.

This subcommand is used with the MAPLE_COMMAND_CAMCONTROL command to fetch part of image data from the specified image.

Typedef Documentation

Dreameye status structure.

This structure contains information about the status of the Camera device and can be fetched with maple_dev_status(). You should not change any of this information, it should all be considered read-only. Most of the fields in here are related to image transfers, and messing with them during a transfer could screw things up.

Function Documentation

int dreameye_erase_image ( maple_device_t dev,
uint8  image,
int  block 
)

Erase an image from the Dreameye.

This function erases the specified image from the Dreameye device. This command can be sent to any of the subdevices of the MAPLE_FUNC_CONTROLLER root device of the Dreameye.

Parameters
devThe device to erase from.
imageThe image number to erase (0xFF to erase all).
blockSet to 1 to wait for the Dreameye to respond.
Return values
MAPLE_EOKOn success.
MAPLE_EAGAINCouldn't send the command, try again.
MAPLE_ETIMEOUTTimeout on blocking.
MAPLE_EINVALIDInvalid image number specified.
int dreameye_get_image ( maple_device_t dev,
uint8  image,
uint8 **  data,
int *  img_sz 
)

Transfer an image from the Dreameye.

This function fetches a single image from the specified Dreameye device. This function will block, and can take a little while to execute. You must use the first subdevice of the MAPLE_FUNC_CONTROLLER root device of the Dreameye as the dev parameter.

Parameters
devThe device to get an image from.
imageThe image number to download.
dataA pointer to a buffer to store things in. This will be allocated by the function and you are responsible for freeing the data when you are done.
img_szA pointer to storage for the size of the image, in bytes.
Return values
MAPLE_EOKOn success.
MAPLE_EFAILOn error.
int dreameye_get_image_count ( maple_device_t dev,
int  block 
)

Get the number of images on the Dreameye.

This function fetches the number of saved images on the specified Dreameye device. It can be sent to any of the subdevices of the MAPLE_FUNC_CONTROLLER root device of the Dreameye. When the response comes from the device, the image_count field of the dreameye_state_t for the specified device will have the number of images on the device, and image_count_valid will be set to 1.

Parameters
devThe device to query.
blockSet to 1 to wait for the Dreameye to respond.
Return values
MAPLE_EOKOn success.
MAPLE_ETIMEOUTThe command timed out while blocking.
MAPLE_EAGAINCould not send the command to the device, try again.