The modified AndroidAccessory Library
Dependents: ADKTerm droidcycle uva_nc androidservo ... more
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:
-
rbuffsize The size of the read buffer wbuffsize The size of the write buffer manufacturer The manufacturer of the accessory model The model of the accessory description A short description of the accessory version The current version of the accessory uri Some data to go with the accessory (URL or more description) serial The 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:
-
buff The buffered read in data len The 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:
-
device Device number configuration Configuration interfaceNumber Inteface 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:
-
buff The buffer to read into len The length of the packet to read in returns The 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:
-
buff The buffer to write out len The 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:
-
buff The buffer to write out len The 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.
Generated on Tue Jul 12 2022 15:55:45 by 1.7.2