| controller.h | | controller.h | |
| | | | |
| skipping to change at line 35 | | skipping to change at line 35 | |
| #include "dll.h" | | #include "dll.h" | |
| #include "socket.h" | | #include "socket.h" | |
| | | | |
| /// Project namespace, containing all related functions and classes. | | /// Project namespace, containing all related functions and classes. | |
| /// This is the only namespace applications should be concerned with, | | /// This is the only namespace applications should be concerned with, | |
| /// for now. | | /// for now. | |
| namespace Barry { | | namespace Barry { | |
| | | | |
| // forward declarations | | // forward declarations | |
| class SocketRoutingQueue; | | class SocketRoutingQueue; | |
|
| class ProbeResult; | | struct ProbeResult; | |
| | | | |
| class PrivateControllerData; | | class PrivateControllerData; | |
| | | | |
| namespace Mode { | | namespace Mode { | |
| class Mode; | | class Mode; | |
| class IpModem; | | class IpModem; | |
| class Serial; | | class Serial; | |
| class JavaLoader; | | class JavaLoader; | |
| class JVMDebug; | | class JVMDebug; | |
| class RawChannel; | | class RawChannel; | |
| | | | |
| skipping to change at line 95 | | skipping to change at line 95 | |
| Desktop, //< desktop mode required for databa
se | | Desktop, //< desktop mode required for databa
se | |
| //< operation | | //< operation | |
| JavaLoader, //< experimental | | JavaLoader, //< experimental | |
| JVMDebug, //< experimental | | JVMDebug, //< experimental | |
| UsbSerData, //< GPRS modem support over USB | | UsbSerData, //< GPRS modem support over USB | |
| UsbSerCtrl, //< internally used behind the scene
s | | UsbSerCtrl, //< internally used behind the scene
s | |
| RawChannel //< raw channel | | RawChannel //< raw channel | |
| }; | | }; | |
| | | | |
| private: | | private: | |
|
| std::auto_ptr<PrivateControllerData> m_priv; | | const std::auto_ptr<PrivateControllerData> m_priv; | |
| | | | |
| private: | | private: | |
|
| | | Controller(const Controller& rhs); // prevent copying | |
| void SetupUsb(const ProbeResult &device); | | void SetupUsb(const ProbeResult &device); | |
| | | | |
| protected: | | protected: | |
| uint16_t SelectMode(ModeType mode); // returns mode socket | | uint16_t SelectMode(ModeType mode); // returns mode socket | |
| uint16_t SelectMode(ModeType mode, const char *explicitModeName); //
returns mode socket | | uint16_t SelectMode(ModeType mode, const char *explicitModeName); //
returns mode socket | |
| SocketHandle OpenSocket(uint16_t socket, const char *password = 0); | | SocketHandle OpenSocket(uint16_t socket, const char *password = 0); | |
| PrivateControllerData* GetPrivate() { return m_priv.get(); } | | PrivateControllerData* GetPrivate() { return m_priv.get(); } | |
| | | | |
| public: | | public: | |
| explicit Controller(const ProbeResult &device, | | explicit Controller(const ProbeResult &device, | |
| | | | |
End of changes. 3 change blocks. |
| 2 lines changed or deleted | | 3 lines changed or added | |
|
| data.h | | data.h | |
| | | | |
| skipping to change at line 31 | | skipping to change at line 31 | |
| | | | |
| #ifndef __SB_DATA_H__ | | #ifndef __SB_DATA_H__ | |
| #define __SB_DATA_H__ | | #define __SB_DATA_H__ | |
| | | | |
| #include "dll.h" | | #include "dll.h" | |
| #include <iosfwd> | | #include <iosfwd> | |
| #include <vector> | | #include <vector> | |
| #include <string> | | #include <string> | |
| #include <stdint.h> | | #include <stdint.h> | |
| | | | |
|
| | | #define BARRY_DATA_DEFAULT_SIZE 0x4000 | |
| | | #define BARRY_DATA_DEFAULT_PREPEND_SIZE 0x100 | |
| | | | |
| namespace Barry { | | namespace Barry { | |
| | | | |
| class BXEXPORT Data | | class BXEXPORT Data | |
| { | | { | |
| unsigned char *m_memBlock; //< pointer to full memory block | | unsigned char *m_memBlock; //< pointer to full memory block | |
| //< can be null if external | | //< can be null if external | |
| size_t m_blockSize; //< size of m_memBlock buffer alloca
ted | | size_t m_blockSize; //< size of m_memBlock buffer alloca
ted | |
| | | | |
| unsigned char *m_dataStart; //< pointer to start of internal dat
a | | unsigned char *m_dataStart; //< pointer to start of internal dat
a | |
| //< can be null if external, and can | | //< can be null if external, and can | |
| | | | |
| skipping to change at line 63 | | skipping to change at line 66 | |
| | | | |
| // output format flags | | // output format flags | |
| static bool bPrintAscii; | | static bool bPrintAscii; | |
| | | | |
| protected: | | protected: | |
| void MakeSpace(size_t desiredsize, size_t desiredprepend = 0); | | void MakeSpace(size_t desiredsize, size_t desiredprepend = 0); | |
| size_t AvailablePrependSpace() const; | | size_t AvailablePrependSpace() const; | |
| | | | |
| public: | | public: | |
| Data(); | | Data(); | |
|
| explicit Data(int endpoint, size_t startsize = 0x4000, size_t prepen
dsize = 0x100); | | explicit Data(int endpoint, size_t startsize = BARRY_DATA_DEFAULT_SI
ZE, size_t prependsize = BARRY_DATA_DEFAULT_PREPEND_SIZE); | |
| Data(const void *ValidData, size_t size); | | Data(const void *ValidData, size_t size); | |
| Data(const Data &other); | | Data(const Data &other); | |
| ~Data(); | | ~Data(); | |
| | | | |
| void InputHexLine(std::istream &is); | | void InputHexLine(std::istream &is); | |
| void DumpHexLine(std::ostream &os, size_t index, size_t size) const; | | void DumpHexLine(std::ostream &os, size_t index, size_t size) const; | |
| void DumpHex(std::ostream &os) const; | | void DumpHex(std::ostream &os) const; | |
| | | | |
| int GetEndpoint() const { return m_endpoint; } | | int GetEndpoint() const { return m_endpoint; } | |
| | | | |
| | | | |
End of changes. 2 change blocks. |
| 1 lines changed or deleted | | 4 lines changed or added | |
|
| dataqueue.h | | dataqueue.h | |
| | | | |
| skipping to change at line 25 | | skipping to change at line 25 | |
| but WITHOUT ANY WARRANTY; without even the implied warranty of | | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
| | | | |
| See the GNU General Public License in the COPYING file at the | | See the GNU General Public License in the COPYING file at the | |
| root directory of this project for more details. | | root directory of this project for more details. | |
| */ | | */ | |
| | | | |
| #ifndef __BARRY_DATAQUEUE_H__ | | #ifndef __BARRY_DATAQUEUE_H__ | |
| #define __BARRY_DATAQUEUE_H__ | | #define __BARRY_DATAQUEUE_H__ | |
| | | | |
|
| | | #include "dll.h" | |
| #include <list> | | #include <list> | |
| #include <pthread.h> | | #include <pthread.h> | |
| #include <iosfwd> | | #include <iosfwd> | |
| | | | |
| namespace Barry { | | namespace Barry { | |
| | | | |
| class Data; | | class Data; | |
| | | | |
| // | | // | |
| // DataQueue class | | // DataQueue class | |
| // | | // | |
| /// This class provides a thread aware fifo queue for Data objects, | | /// This class provides a thread aware fifo queue for Data objects, | |
| /// providing memory management for all Data object pointers it contains. | | /// providing memory management for all Data object pointers it contains. | |
| /// | | /// | |
| /// It uses similar member names as std::queue<>, for consistency. | | /// It uses similar member names as std::queue<>, for consistency. | |
| /// | | /// | |
|
| class DataQueue | | class BXEXPORT DataQueue | |
| { | | { | |
| // always use the raw_push() and raw_pop() functions | | // always use the raw_push() and raw_pop() functions | |
| typedef std::list<Data*> queue_type; | | typedef std::list<Data*> queue_type; | |
| | | | |
| pthread_mutex_t m_waitMutex; | | pthread_mutex_t m_waitMutex; | |
| pthread_cond_t m_waitCond; | | pthread_cond_t m_waitCond; | |
| | | | |
| mutable pthread_mutex_t m_accessMutex; // locked for each access of
m_queue | | mutable pthread_mutex_t m_accessMutex; // locked for each access of
m_queue | |
| | | | |
| queue_type m_queue; | | queue_type m_queue; | |
| | | | |
End of changes. 2 change blocks. |
| 1 lines changed or deleted | | 2 lines changed or added | |
|
| parser.h | | parser.h | |
| | | | |
| skipping to change at line 149 | | skipping to change at line 149 | |
| std::string m_last_dbname; | | std::string m_last_dbname; | |
| | | | |
| public: | | public: | |
| explicit HexDumpParser(std::ostream &os); | | explicit HexDumpParser(std::ostream &os); | |
| | | | |
| virtual void ParseRecord(const Barry::DBData &data, | | virtual void ParseRecord(const Barry::DBData &data, | |
| const IConverter *ic); | | const IConverter *ic); | |
| }; | | }; | |
| | | | |
| // | | // | |
|
| | | // DBNamesOnlyParser | |
| | | // | |
| | | /// Prints only the unique databases names found in the stream. | |
| | | /// | |
| | | /// Do NOT derive your own personal parser classes from this, | |
| | | /// unless you are perfectly confident that you will catch | |
| | | /// future API changes on the devel tree without the compiler's | |
| | | /// help. | |
| | | /// | |
| | | class BXEXPORT DBNamesOnlyParser : public Parser | |
| | | { | |
| | | std::ostream &m_os; | |
| | | std::string m_last_dbname; | |
| | | | |
| | | public: | |
| | | explicit DBNamesOnlyParser(std::ostream &os); | |
| | | | |
| | | virtual void ParseRecord(const Barry::DBData &data, | |
| | | const IConverter *ic); | |
| | | }; | |
| | | | |
| | | // | |
| // RecordParserBase | | // RecordParserBase | |
| // | | // | |
| /// Abstract base class for the following RecordParser template, that expos
es | | /// Abstract base class for the following RecordParser template, that expos
es | |
| /// some information on the specifics that the record parser can handle. | | /// some information on the specifics that the record parser can handle. | |
| /// Specifically, it exposes the database name it is able to parse | | /// Specifically, it exposes the database name it is able to parse | |
| /// | | /// | |
| class BXEXPORT RecordParserBase : public Parser | | class BXEXPORT RecordParserBase : public Parser | |
| { | | { | |
| public: | | public: | |
| // These functions are always valid, regardless of the | | // These functions are always valid, regardless of the | |
| | | | |
End of changes. 1 change blocks. |
| 0 lines changed or deleted | | 22 lines changed or added | |
|
| record.h | | record.h | |
| | | | |
| skipping to change at line 38 | | skipping to change at line 38 | |
| #define __BARRY_RECORD_H__ | | #define __BARRY_RECORD_H__ | |
| | | | |
| #include "dll.h" | | #include "dll.h" | |
| #include <iosfwd> | | #include <iosfwd> | |
| #include <string> | | #include <string> | |
| #include <vector> | | #include <vector> | |
| #include <map> | | #include <map> | |
| #include <stdint.h> | | #include <stdint.h> | |
| #include <stdexcept> | | #include <stdexcept> | |
| | | | |
|
| | | #ifdef WINCE | |
| | | /* The WinCE compiler v14.00.60131 doesn't like using operator= from base c | |
| | | lasses, so don't | |
| | | * confuse it with a using directive. */ | |
| | | #define USE_BASE_ASSIGNMENT_OPERATOR | |
| | | #else | |
| | | #define USE_BASE_ASSIGNMENT_OPERATOR using base_type::operator=; | |
| | | #endif | |
| | | | |
| // forward declarations | | // forward declarations | |
| namespace Barry { class Data; } | | namespace Barry { class Data; } | |
| | | | |
| namespace Barry { | | namespace Barry { | |
| | | | |
| // | | // | |
| // NOTE: All classes here must be container-safe! Perhaps add sorting | | // NOTE: All classes here must be container-safe! Perhaps add sorting | |
| // operators in the future. | | // operators in the future. | |
| // | | // | |
| | | | |
| // stream-based wrapper to avoid printing strings that contain | | // stream-based wrapper to avoid printing strings that contain | |
| // the \r carriage return characters | | // the \r carriage return characters | |
| class BXEXPORT Cr2LfWrapper | | class BXEXPORT Cr2LfWrapper | |
| { | | { | |
|
| friend std::ostream& operator<< (std::ostream &os, const Cr2LfWrappe
r &str); | | friend BXEXPORT std::ostream& operator<< (std::ostream &os, const Cr
2LfWrapper &str); | |
| const std::string &m_str; | | const std::string &m_str; | |
| public: | | public: | |
| explicit Cr2LfWrapper(const std::string &str) | | explicit Cr2LfWrapper(const std::string &str) | |
| : m_str(str) | | : m_str(str) | |
| { | | { | |
| } | | } | |
| }; | | }; | |
| BXEXPORT std::ostream& operator<< (std::ostream &os, const Cr2LfWrapper &st
r); | | BXEXPORT std::ostream& operator<< (std::ostream &os, const Cr2LfWrapper &st
r); | |
| | | | |
| /// Struct wrapper for time_t, to make sure that it has its own type, | | /// Struct wrapper for time_t, to make sure that it has its own type, | |
| | | | |
| skipping to change at line 307 | | skipping to change at line 315 | |
| using base_type::resize; | | using base_type::resize; | |
| using base_type::reserve; | | using base_type::reserve; | |
| using base_type::front; | | using base_type::front; | |
| using base_type::back; | | using base_type::back; | |
| using base_type::push_back; | | using base_type::push_back; | |
| using base_type::pop_back; | | using base_type::pop_back; | |
| using base_type::insert; | | using base_type::insert; | |
| using base_type::erase; | | using base_type::erase; | |
| using base_type::swap; | | using base_type::swap; | |
| using base_type::clear; | | using base_type::clear; | |
|
| using base_type::operator=; | | | |
| using base_type::operator[]; | | using base_type::operator[]; | |
|
| | | USE_BASE_ASSIGNMENT_OPERATOR | |
| }; | | }; | |
| BXEXPORT std::ostream& operator<< (std::ostream &os, const EmailList &list)
; | | BXEXPORT std::ostream& operator<< (std::ostream &os, const EmailList &list)
; | |
| | | | |
| // struct, attempting to combine name + email address, for mail | | // struct, attempting to combine name + email address, for mail | |
| struct BXEXPORT EmailAddress | | struct BXEXPORT EmailAddress | |
| { | | { | |
| std::string Name; | | std::string Name; | |
| std::string Email; | | std::string Email; | |
| | | | |
| EmailAddress() | | EmailAddress() | |
| | | | |
| skipping to change at line 448 | | skipping to change at line 456 | |
| unsigned int v1 = Year * 10000 + Month * 100 + Day; | | unsigned int v1 = Year * 10000 + Month * 100 + Day; | |
| unsigned int v2 = other.Year * 10000 + other.Month * 100 + o
ther.Day; | | unsigned int v2 = other.Year * 10000 + other.Month * 100 + o
ther.Day; | |
| return v1 < v2; | | return v1 < v2; | |
| } | | } | |
| }; | | }; | |
| BXEXPORT std::ostream& operator<<(std::ostream &os, const Date &date); | | BXEXPORT std::ostream& operator<<(std::ostream &os, const Date &date); | |
| | | | |
| class BXEXPORT CategoryList : public std::vector<std::string> | | class BXEXPORT CategoryList : public std::vector<std::string> | |
| { | | { | |
| public: | | public: | |
|
| | | typedef std::vector<std::string> base_type; | |
| | | | |
| | | public: | |
| /// Parses the given comma delimited category string into | | /// Parses the given comma delimited category string into | |
| /// this CategoryList object, appending each token to the vector. | | /// this CategoryList object, appending each token to the vector. | |
| /// Will clear vector beforehand. | | /// Will clear vector beforehand. | |
| void CategoryStr2List(const std::string &str); | | void CategoryStr2List(const std::string &str); | |
| | | | |
| /// Turns the current vectory into a comma delimited category | | /// Turns the current vectory into a comma delimited category | |
| /// string suitable for use in Calendar, Task, and Memo | | /// string suitable for use in Calendar, Task, and Memo | |
| /// protocol values. | | /// protocol values. | |
| void CategoryList2Str(std::string &str) const; | | void CategoryList2Str(std::string &str) const; | |
| | | | |
|
| using std::vector<std::string>::operator=; | | USE_BASE_ASSIGNMENT_OPERATOR | |
| }; | | }; | |
| BXEXPORT std::ostream& operator<<(std::ostream &os, const CategoryList &cl)
; | | BXEXPORT std::ostream& operator<<(std::ostream &os, const CategoryList &cl)
; | |
| | | | |
| ///////////////////////////////////////////////////////////////////////////
/// | | ///////////////////////////////////////////////////////////////////////////
/// | |
| // Generic Field Handles | | // Generic Field Handles | |
| | | | |
| /// \addtogroup GenericFieldHandles | | /// \addtogroup GenericFieldHandles | |
| /// Generic field handle classes, used to reference and work | | /// Generic field handle classes, used to reference and work | |
| /// with record members in a flexible, indirect way. | | /// with record members in a flexible, indirect way. | |
| /// | | /// | |
| | | | |
End of changes. 6 change blocks. |
| 3 lines changed or deleted | | 15 lines changed or added | |
|
| trim.h | | trim.h | |
| // Found at: | | // Found at: | |
| // http://stackoverflow.com/questions/216823/whats-the-best-way-to-trim-std
string | | // http://stackoverflow.com/questions/216823/whats-the-best-way-to-trim-std
string | |
| | | | |
| // Note that these functions trim the same arguments passed in, and do not | | // Note that these functions trim the same arguments passed in, and do not | |
| // make copies. | | // make copies. | |
| | | | |
| #ifndef __BARRY_TRIM_H__ | | #ifndef __BARRY_TRIM_H__ | |
| #define __BARRY_TRIM_H__ | | #define __BARRY_TRIM_H__ | |
| | | | |
|
| | | #include <stdlib.h> | |
| #include <algorithm> | | #include <algorithm> | |
| #include <functional> | | #include <functional> | |
| #include <locale> | | #include <locale> | |
| | | | |
| namespace Barry { namespace Inplace { | | namespace Barry { namespace Inplace { | |
| | | | |
|
| | | // Windows CE defines std::isspace(int) as a macro to a function with | |
| | | // two arguments with one prefilled, so a wrapper function is needed. | |
| | | static inline int isSpaceChar(int c) { | |
| | | return std::isspace(c); | |
| | | } | |
| | | | |
| // trim from start | | // trim from start | |
| static inline std::string <rim(std::string &s) { | | static inline std::string <rim(std::string &s) { | |
|
| s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not1(std::p | | std::string::iterator end(std::find_if(s.begin(), s.end(), std::not1 | |
| tr_fun<int, int>(std::isspace)))); | | (std::ptr_fun<int, int>(isSpaceChar)))); | |
| | | s.erase(s.begin(), end); | |
| return s; | | return s; | |
| } | | } | |
| | | | |
| // trim from end | | // trim from end | |
| static inline std::string &rtrim(std::string &s) { | | static inline std::string &rtrim(std::string &s) { | |
|
| s.erase(std::find_if(s.rbegin(), s.rend(), std::not1(std::ptr_fun<in | | std::string::reverse_iterator start(std::find_if(s.rbegin(), s.rend( | |
| t, int>(std::isspace))).base(), s.end()); | | ), std::not1(std::ptr_fun<int, int>(isSpaceChar)))); | |
| | | s.erase(start.base(), s.end()); | |
| return s; | | return s; | |
| } | | } | |
| | | | |
| // trim from both ends | | // trim from both ends | |
| static inline std::string &trim(std::string &s) { | | static inline std::string &trim(std::string &s) { | |
| return ltrim(rtrim(s)); | | return ltrim(rtrim(s)); | |
| } | | } | |
| | | | |
| }} // namespace Barry::Inplace | | }} // namespace Barry::Inplace | |
| | | | |
| | | | |
End of changes. 4 change blocks. |
| 4 lines changed or deleted | | 13 lines changed or added | |
|
| usbwrap.h | | usbwrap.h | |
| | | | |
| skipping to change at line 152 | | skipping to change at line 152 | |
| IsochronousType = 1, | | IsochronousType = 1, | |
| BulkType = 2, | | BulkType = 2, | |
| InterruptType = 3, | | InterruptType = 3, | |
| InvalidType = 0xff | | InvalidType = 0xff | |
| }; | | }; | |
| private: | | private: | |
| const std::auto_ptr<EndpointDescriptorImpl> m_impl; | | const std::auto_ptr<EndpointDescriptorImpl> m_impl; | |
| bool m_read; | | bool m_read; | |
| uint8_t m_addr; | | uint8_t m_addr; | |
| EpType m_type; | | EpType m_type; | |
|
| | | private: | |
| | | EndpointDescriptor(const EndpointDescriptor& rhs); // Prevent copyin | |
| | | g | |
| public: | | public: | |
| EndpointDescriptor(InterfaceDescriptor& dev, int endpoint); | | EndpointDescriptor(InterfaceDescriptor& dev, int endpoint); | |
| ~EndpointDescriptor(); | | ~EndpointDescriptor(); | |
| bool IsRead() const; | | bool IsRead() const; | |
| uint8_t GetAddress() const; | | uint8_t GetAddress() const; | |
| EpType GetType() const; | | EpType GetType() const; | |
| }; | | }; | |
| | | | |
| // Private struct for holding library specific | | // Private struct for holding library specific | |
| // information about interface descriptors | | // information about interface descriptors | |
| | | | |
| skipping to change at line 174 | | skipping to change at line 176 | |
| // Encapsulates an interface descriptor | | // Encapsulates an interface descriptor | |
| // | | // | |
| // The inherited vector methods look up endpoints | | // The inherited vector methods look up endpoints | |
| class BXEXPORT InterfaceDescriptor : public std::vector<EndpointDescriptor*
> | | class BXEXPORT InterfaceDescriptor : public std::vector<EndpointDescriptor*
> | |
| { | | { | |
| friend class EndpointDescriptor; | | friend class EndpointDescriptor; | |
| public: | | public: | |
| typedef std::vector<EndpointDescriptor*> base_type; | | typedef std::vector<EndpointDescriptor*> base_type; | |
| private: | | private: | |
| const std::auto_ptr<InterfaceDescriptorImpl> m_impl; | | const std::auto_ptr<InterfaceDescriptorImpl> m_impl; | |
|
| | | private: | |
| | | InterfaceDescriptor(const InterfaceDescriptor& rhs); // Prevent copy | |
| | | ing | |
| public: | | public: | |
| InterfaceDescriptor(ConfigDescriptor& cfgdesc, | | InterfaceDescriptor(ConfigDescriptor& cfgdesc, | |
|
| int interface, int altsetting); | | int iface, int altsetting); | |
| ~InterfaceDescriptor(); | | ~InterfaceDescriptor(); | |
| uint8_t GetClass() const; | | uint8_t GetClass() const; | |
| uint8_t GetNumber() const; | | uint8_t GetNumber() const; | |
| uint8_t GetAltSetting() const; | | uint8_t GetAltSetting() const; | |
| }; | | }; | |
| | | | |
| // Private struct for holding library specific | | // Private struct for holding library specific | |
| // information about config descriptors | | // information about config descriptors | |
| | | | |
| struct ConfigDescriptorImpl; | | struct ConfigDescriptorImpl; | |
| | | | |
| skipping to change at line 198 | | skipping to change at line 202 | |
| // Encapsulates a configuration descriptor | | // Encapsulates a configuration descriptor | |
| // | | // | |
| // The inherited map methods look up interface descriptors | | // The inherited map methods look up interface descriptors | |
| class BXEXPORT ConfigDescriptor : public std::map<int, InterfaceDescriptor*
> | | class BXEXPORT ConfigDescriptor : public std::map<int, InterfaceDescriptor*
> | |
| { | | { | |
| friend class InterfaceDescriptor; | | friend class InterfaceDescriptor; | |
| public: | | public: | |
| typedef std::map<int, InterfaceDescriptor*> base_type; | | typedef std::map<int, InterfaceDescriptor*> base_type; | |
| private: | | private: | |
| const std::auto_ptr<ConfigDescriptorImpl> m_impl; | | const std::auto_ptr<ConfigDescriptorImpl> m_impl; | |
|
| | | private: | |
| | | ConfigDescriptor(const ConfigDescriptor& rhs); // Prevent copying | |
| public: | | public: | |
| ConfigDescriptor(DeviceDescriptor& dev, int cfgnumber); | | ConfigDescriptor(DeviceDescriptor& dev, int cfgnumber); | |
| ~ConfigDescriptor(); | | ~ConfigDescriptor(); | |
| uint8_t GetNumber() const; | | uint8_t GetNumber() const; | |
| }; | | }; | |
| | | | |
| // Private struct for holding library specific | | // Private struct for holding library specific | |
| // information about a device descriptor | | // information about a device descriptor | |
| struct DeviceDescriptorImpl; | | struct DeviceDescriptorImpl; | |
| | | | |
| // Encapsulates a device descriptor | | // Encapsulates a device descriptor | |
| // | | // | |
| // The inherited map methods look up config descriptors | | // The inherited map methods look up config descriptors | |
| class BXEXPORT DeviceDescriptor : public std::map<int, ConfigDescriptor*> | | class BXEXPORT DeviceDescriptor : public std::map<int, ConfigDescriptor*> | |
| { | | { | |
| friend class ConfigDescriptor; | | friend class ConfigDescriptor; | |
| public: | | public: | |
| typedef std::map<int, ConfigDescriptor*> base_type; | | typedef std::map<int, ConfigDescriptor*> base_type; | |
| private: | | private: | |
| const std::auto_ptr<DeviceDescriptorImpl> m_impl; | | const std::auto_ptr<DeviceDescriptorImpl> m_impl; | |
|
| | | private: | |
| | | DeviceDescriptor(const DeviceDescriptor& rhs); // Prevent copying | |
| public: | | public: | |
| DeviceDescriptor(DeviceID& devid); | | DeviceDescriptor(DeviceID& devid); | |
| ~DeviceDescriptor(); | | ~DeviceDescriptor(); | |
| }; | | }; | |
| | | | |
| // Private struct for holding library specific | | // Private struct for holding library specific | |
| // information for devices. | | // information for devices. | |
| struct DeviceListImpl; | | struct DeviceListImpl; | |
| | | | |
| class BXEXPORT DeviceList | | class BXEXPORT DeviceList | |
| { | | { | |
| private: | | private: | |
| // Private implementation structure | | // Private implementation structure | |
| const std::auto_ptr<DeviceListImpl> m_impl; | | const std::auto_ptr<DeviceListImpl> m_impl; | |
|
| | | private: | |
| | | DeviceList(const DeviceList& rhs); // Prevent copying | |
| public: | | public: | |
| DeviceList(); | | DeviceList(); | |
| ~DeviceList(); | | ~DeviceList(); | |
| | | | |
| std::vector<DeviceID> MatchDevices(int vendor, int product, | | std::vector<DeviceID> MatchDevices(int vendor, int product, | |
| const char *busname, const char *
devname); | | const char *busname, const char *
devname); | |
| | | | |
| }; | | }; | |
| | | | |
| struct PrivateDeviceData; | | struct PrivateDeviceData; | |
| | | | |
| class BXEXPORT Device | | class BXEXPORT Device | |
| { | | { | |
| private: | | private: | |
| Usb::DeviceID m_id; | | Usb::DeviceID m_id; | |
|
| std::auto_ptr<Usb::DeviceHandle> m_handle; | | const std::auto_ptr<Usb::DeviceHandle> m_handle; | |
| | | | |
| int m_timeout; | | int m_timeout; | |
| int m_lasterror; | | int m_lasterror; | |
|
| | | private: | |
| | | Device(const Device& rhs); // Prevent copying | |
| public: | | public: | |
| Device(const Usb::DeviceID& id, int timeout = USBWRAP_DEFAULT_TIMEOU
T); | | Device(const Usb::DeviceID& id, int timeout = USBWRAP_DEFAULT_TIMEOU
T); | |
| ~Device(); | | ~Device(); | |
| | | | |
| ///////////////////////////// | | ///////////////////////////// | |
| // Data access | | // Data access | |
| | | | |
| const Usb::DeviceID& GetID() const { return m_id; } | | const Usb::DeviceID& GetID() const { return m_id; } | |
| const Usb::DeviceHandle* GetHandle() const { return &*m_handle; } | | const Usb::DeviceHandle* GetHandle() const { return &*m_handle; } | |
| int GetLastError() const { return m_lasterror; } //< not thread safe
... | | int GetLastError() const { return m_lasterror; } //< not thread safe
... | |
| //< use the error code stored in the exceptions to track | | //< use the error code stored in the exceptions to track | |
| //< errors in threaded usage | | //< errors in threaded usage | |
| void SetLastError(int err) { m_lasterror = err; } | | void SetLastError(int err) { m_lasterror = err; } | |
| int GetDefaultTimeout() const { return m_timeout; } | | int GetDefaultTimeout() const { return m_timeout; } | |
| | | | |
| ///////////////////////////// | | ///////////////////////////// | |
| // Device information | | // Device information | |
| | | | |
| int GetPowerLevel(); | | int GetPowerLevel(); | |
| int FindInterface(int ifaceClass); | | int FindInterface(int ifaceClass); | |
|
| | | std::string GetSimpleSerialNumber(); | |
| | | | |
| ///////////////////////////// | | ///////////////////////////// | |
| // Device manipulation | | // Device manipulation | |
| | | | |
| bool SetConfiguration(unsigned char cfg); | | bool SetConfiguration(unsigned char cfg); | |
| bool ClearHalt(int ep); | | bool ClearHalt(int ep); | |
| bool Reset(); | | bool Reset(); | |
| bool IsAttachKernelDriver(int iface); | | bool IsAttachKernelDriver(int iface); | |
| bool DetachKernelDriver(int iface); | | bool DetachKernelDriver(int iface); | |
| | | | |
| | | | |
End of changes. 9 change blocks. |
| 3 lines changed or deleted | | 17 lines changed or added | |
|