The modified AndroidAccessory Library

Dependents:   ADKTerm droidcycle uva_nc androidservo ... more

Embed: (wiki syntax)

« Back to documentation index

AndroidAccessory Class Reference

AndroidAccessory Class Reference

An AndroidAccessory control class. More...

#include <AndroidAccessory.h>

Public Member Functions

 AndroidAccessory (int rbuffsize, int wbuffsize, const char *manufacturer, const char *model, const char *description, const char *version, const char *uri, const char *serial)
 Create a AndroidAccessory object.
virtual void init (int device, int configuration, int interfaceNumber)
 Init the device This is meant to be implimented by the user of the class.
virtual void resetDevice ()=0
 Reset the device This is meant to be implimented by the user of the class.
virtual void setupDevice ()=0
 Setup the device This is meant to be implimented by the user of the class.
virtual int callbackRead (u8 *buff, int len)=0
 Callback on Read This is meant to be implimented by the user of the class.
virtual int callbackWrite ()=0
 Callback after Write This is meant to be implimented by the user of the class.
int write (u8 *buff, int len)
 Write over USB This sends the data in the buffer over USB in a packet.
int write ()
 Write over USB This sends the data in the buffer over USB in a packet, sends _writebuff and _writebuffsize.
int writeNC (u8 *buff, int len)
 Write over USB with no callback This sends the data in the buffer over USB in a packet, waits until the packet is sent, rather than doing a callback.
int writeNC ()
 Write over USB This sends the data in the buffer over USB in a packet, waits until the packet is sent, rather than doing a callback, sends _writebuff and _writebuffsize.
int read (u8 *buff, int len)
 Read the buffer USB This sends the data in the buffer over USB in a packet, waits until the packet is sent, rather than doing a callback.

Detailed Description

An AndroidAccessory control class.

It allows easy creation of a mbed android ADK accessory, with minimal low level fussing. Base code should have methods resetDevice(), setupDevice(), callbackRead(u8 *buff, int len) and callBackWrite() functions

Definition at line 45 of file AndroidAccessory.h.


Constructor & Destructor Documentation

AndroidAccessory ( int  rbuffsize,
int  wbuffsize,
const char *  manufacturer,
const char *  model,
const char *  description,
const char *  version,
const char *  uri,
const char *  serial 
)

Create a AndroidAccessory object.

Create a AndroidAccessoryobject with specified buffer sizes and infomation

Parameters:
rbuffsizeThe size of the read buffer
wbuffsizeThe size of the write buffer
manufacturerThe manufacturer of the accessory
modelThe model of the accessory
descriptionA short description of the accessory
versionThe current version of the accessory
uriSome data to go with the accessory (URL or more description)
serialThe serial number of the accessory

Definition at line 16 of file AndroidAccessory.cpp.


Member Function Documentation

virtual int callbackRead ( u8 *  buff,
int  len 
) [pure virtual]

Callback on Read This is meant to be implimented by the user of the class.

Called when some data has been read in.

Parameters:
buffThe buffered read in data
lenThe length of the packet recived
virtual int callbackWrite (  ) [pure virtual]

Callback after Write This is meant to be implimented by the user of the class.

Called when the write has been finished.

void init ( int  device,
int  configuration,
int  interfaceNumber 
) [virtual]

Init the device This is meant to be implimented by the user of the class.

Parameters:
deviceDevice number
configurationConfiguration
interfaceNumberInteface number

Definition at line 84 of file AndroidAccessory.cpp.

int read ( u8 *  buff,
int  len 
)

Read the buffer USB This sends the data in the buffer over USB in a packet, waits until the packet is sent, rather than doing a callback.

Parameters:
buffThe buffer to read into
lenThe length of the packet to read in
returnsThe number of bytes read

Definition at line 72 of file AndroidAccessory.cpp.

virtual void resetDevice (  ) [pure virtual]

Reset the device This is meant to be implimented by the user of the class.

virtual void setupDevice (  ) [pure virtual]

Setup the device This is meant to be implimented by the user of the class.

Called when the device is first intialised

int write ( u8 *  buff,
int  len 
)

Write over USB This sends the data in the buffer over USB in a packet.

Parameters:
buffThe buffer to write out
lenThe length of the packet to send

Definition at line 53 of file AndroidAccessory.cpp.

int write (  )

Write over USB This sends the data in the buffer over USB in a packet, sends _writebuff and _writebuffsize.

Definition at line 121 of file AndroidAccessory.h.

int writeNC ( u8 *  buff,
int  len 
)

Write over USB with no callback This sends the data in the buffer over USB in a packet, waits until the packet is sent, rather than doing a callback.

Parameters:
buffThe buffer to write out
lenThe length of the packet to send

Definition at line 61 of file AndroidAccessory.cpp.

int writeNC (  )

Write over USB This sends the data in the buffer over USB in a packet, waits until the packet is sent, rather than doing a callback, sends _writebuff and _writebuffsize.

Definition at line 138 of file AndroidAccessory.h.