#include <yepp.h>
Collaboration diagram for yepp:
Public Member Functions | |
yepp () | |
Default constructor.Just some initialization. | |
~yepp () | |
Destructor. | |
void | init (struct usb_device *dev, int usb_debug=0) throw (UsbException, YeppException) |
Open device and check if it is supported. | |
string | last_error () |
Pops all the unread errors from the stack. | |
void | control (int request, unsigned char lsb, unsigned char msb) throw (UsbException, YeppException) |
Sends a control message with yepp::retries retries. | |
void | recv (int request, unsigned char lsb, unsigned char msb, char *buffer, int size) throw (UsbException) |
Reads data from player with control messages. | |
void | send (int request, unsigned char lsb, unsigned char msb, char *buffer, int size) throw (UsbException) |
Sends data to player with control messages. | |
void | move_track (bool internal, unsigned int from, unsigned int to) throw (YeppException, UsbException) |
Change the playlist order. | |
void | get_device_info (void) throw (UsbException, YeppException) |
Ask the device its info string and store it into yepp::device_info_string private attrib. | |
void | get_device_info (string &dev_info) throw (UsbException, YeppException) |
Copy the device info string into the parameter. | |
void | get_playlist (void) throw (YeppException, UsbException) |
Retrieves both internal and external playlist. | |
void | get_playlist (bool internal) throw (YeppException, UsbException) |
Retrieves playlist. | |
void | get_playlist (yeppPlaylist &internal, yeppPlaylist &external) throw (YeppException, UsbException) |
Make a copy of internal and external playlist into supplied parameters. | |
void | get_external_mem_info (void) throw (YeppException, UsbException) |
Gets info about external memory. | |
void | get_device_capacity (int &internal, int &int_avail, int &ext, int &ext_avail) |
Gets total/available bytes in internal and external memory. | |
void | delete_track (unsigned int trackno, bool internal=true) throw (YeppException, UsbException) |
Deletes a track from internal or external memory. | |
void | download (const char *filename, bool internal=true, void(*callback)(int, int)=NULL) throw (UsbException, YeppException) |
Sends a local file to the player's internal or external memory. | |
void | format (bool internal=true) throw (YeppException, UsbException) |
Formats internal memory or external flash. | |
void | upload (unsigned int trackno, string filename="", void(*callback)(int, int)=NULL) throw (YeppException, UsbException) |
Upload a file from the Yepp to the PC. | |
void | reset_read_ep (void) throw (UsbException, YeppException) |
Resets the read endpoint using libusb usb_resetep. | |
void | reset_write_ep (void) throw (UsbException, YeppException) |
Resets the write endpoint using libusb usb_resetep. | |
Public Attributes | |
const int | vendor |
Holds 0x4E8 (Samsung). | |
const int | product |
Holds 0x5A00 (YEPP-NEU). | |
Protected Member Functions | |
void | last_error (string error) |
Push an error to the stack. | |
void | last_error (const char *method, const char *format,...) |
void | clear_send_buffer (void) |
Buffer cleaning. | |
void | clear_bulk_buffer (void) |
Buffer cleaning. | |
void | clear_recv_buffer (void) |
Buffer cleaning. | |
void | clear_control_buffer (void) |
Buffer cleaning. | |
void | clear_buffers (void) |
Clears send and receive buffers.NOT BULK BUFFER. | |
void | clear_halt (unsigned int endpoint) throw (YeppException, UsbException) |
Implements libusb clear_halt. | |
void | reset_ep (unsigned int endpoint) throw (YeppException, UsbException) |
Reset an endpoint. | |
int | file_present (const char *filename, bool internal) |
Checks wheter this file is already present in internal or external playlist. | |
void | build_trackID (string &trackID, string filename) |
Build a trackID as used in download command. | |
Protected Attributes | |
usb_device * | dev |
Got from user in yepp::init. | |
usb_dev_handle * | dev_handle |
Got from yepp::dev. | |
int | usb_debug |
Flag passed to libusb usb_set_debug. | |
int | timeout |
Timeout (in milliseconds) used in USB commands. | |
int | retries |
Number of retries for each send/receive command. | |
Private Attributes | |
stack< string > | error_stack |
Error stack. | |
string | device_info_string |
As read from device. | |
int | has_external_mem |
< 0 if still not checked, 0 if not, > 0 if yes. | |
int | device_capacity |
Capacity of internal memory, in bytes. | |
int | device_space_available |
Available space in internal memory, in bytes. | |
int | external_capacity |
Capacity of external memory, in bytes. | |
int | external_space_available |
Available space in external memory, in bytes. | |
char | send_buffer [USB_BLOCK_SIZE *2] |
Buffer for send commands. | |
char | recv_buffer [USB_BLOCK_SIZE] |
Buffer for receive commands. | |
char | bulk_buffer [YEPP_BULKBUFFER] |
Buffer for bulk transfers. | |
char | control_buffer [USB_BLOCK_SIZE] |
Buffer for control response. | |
const unsigned int | read_endpoint |
const unsigned int | write_endpoint |
const unsigned char | data_length |
yeppPlaylist | playlist |
Internal playlist. | |
yeppPlaylist | ext_playlist |
External playlist, if available. | |
Friends | |
ostream & | operator<< (ostream &os, yepp &u) |
Friendly printout of the class status. |
Definition at line 188 of file yepp.h.
|
Default constructor.Just some initialization.
Definition at line 278 of file yepp.h. References data_length, dev, dev_handle, device_capacity, device_space_available, external_capacity, external_space_available, has_external_mem, product, read_endpoint, retries, timeout, usb_debug, vendor, and write_endpoint. |
|
Destructor. Closes device using libusb and releases interface. |
|
Push an error to the stack.
|
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. |
|
Buffer cleaning.
|
|
Buffer cleaning.
|
|
Buffer cleaning.
|
|
Buffer cleaning.
|
|
Clears send and receive buffers.NOT BULK BUFFER.
|
|
Implements libusb clear_halt.
|
|
Reset an endpoint.
|
|
Checks wheter this file is already present in internal or external playlist.
|
|
Build a trackID as used in download command. trackID is 12 bytes long.
|
|
Open device and check if it is supported. A device is supported vendor/devid are yepp::vendor / yepp::product Opens the device using libusb, sets config and claims interface
|
|
Pops all the unread errors from the stack.
|
|
Sends a control message with yepp::retries retries.
|
|
Reads data from player with control messages. First sends a control message specified by first 3 parameters: request is control code, lsb and msb are the index. Then reads size bytes of data into buffer (usb_bulk_read). Last terminates transaction with control 0x0A wIndex 0xFFFF
|
|
Sends data to player with control messages. First sends a control message specified by first 3 parameters: request is control code, lsb and msb are the index. Then sends size bytes of data from buffer to the player (usb_bulk_write). Last terminates transaction with control 0x0A wIndex 0xFFFF
|
|
Change the playlist order. The track number [from] will be moved to the playlist order [to]. First track is numbered 0.
|
|
Ask the device its info string and store it into yepp::device_info_string private attrib. Device info should be something like
|
|
Copy the device info string into the parameter.
|
|
Retrieves both internal and external playlist.
|
|
Retrieves playlist. Sets capacity/available. Instantiates yepp::playlist / yepp::ext_playlist
|
|
Make a copy of internal and external playlist into supplied parameters.
|
|
Gets info about external memory. Asks for the external playlist and parses output. Sets yepp::external_capacity, yepp::has_external_mem, yepp::external_space_available.
|
|
Gets total/available bytes in internal and external memory. These are internally cached values
|
|
Deletes a track from internal or external memory. Gets playlist if necessary.
|
|
Sends a local file to the player's internal or external memory.
|
|
Formats internal memory or external flash.
|
|
Upload a file from the Yepp to the PC.
|
|
Resets the read endpoint using libusb usb_resetep. Also clears halt status.
|
|
Resets the write endpoint using libusb usb_resetep. Also clears halt status.
|
|
Friendly printout of the class status.
|
|
Error stack. yepp::init method clears the stack and each error is pushed on the stack. Starting from the most high-level function you can retrieve the full error stack with yepp::last_error(), where the most low-level error is shown as last |
|
As read from device.
|
|
< 0 if still not checked, 0 if not, > 0 if yes.
Definition at line 199 of file yepp.h. Referenced by yepp(). |
|
Capacity of internal memory, in bytes.
Definition at line 201 of file yepp.h. Referenced by yepp(). |
|
Available space in internal memory, in bytes.
Definition at line 203 of file yepp.h. Referenced by yepp(). |
|
Capacity of external memory, in bytes.
Definition at line 205 of file yepp.h. Referenced by yepp(). |
|
Available space in external memory, in bytes.
Definition at line 207 of file yepp.h. Referenced by yepp(). |
|
Buffer for send commands.
|
|
Buffer for receive commands.
|
|
Buffer for bulk transfers.
|
|
Buffer for control response.
|
|
Definition at line 216 of file yepp.h. Referenced by yepp(). |
|
Definition at line 217 of file yepp.h. Referenced by yepp(). |
|
Definition at line 218 of file yepp.h. Referenced by yepp(). |
|
Internal playlist.
|
|
External playlist, if available.
|
|
Got from user in yepp::init.
Definition at line 226 of file yepp.h. Referenced by yepp(). |
|
Got from yepp::dev.
Definition at line 228 of file yepp.h. Referenced by yepp(). |
|
Flag passed to libusb usb_set_debug.
Definition at line 230 of file yepp.h. Referenced by yepp(). |
|
Timeout (in milliseconds) used in USB commands.
Definition at line 232 of file yepp.h. Referenced by yepp(). |
|
Number of retries for each send/receive command.
Definition at line 234 of file yepp.h. Referenced by yepp(). |
|
Holds 0x4E8 (Samsung).
Definition at line 273 of file yepp.h. Referenced by yepp(). |
|
Holds 0x5A00 (YEPP-NEU).
Definition at line 275 of file yepp.h. Referenced by yepp(). |