controller.h | controller.h | |||
---|---|---|---|---|
skipping to change at line 29 | skipping to change at line 29 | |||
root directory of this project for more details. | root directory of this project for more details. | |||
*/ | */ | |||
#ifndef __BARRY_CONTROLLER_H__ | #ifndef __BARRY_CONTROLLER_H__ | |||
#define __BARRY_CONTROLLER_H__ | #define __BARRY_CONTROLLER_H__ | |||
#include "usbwrap.h" | #include "usbwrap.h" | |||
#include "probe.h" | #include "probe.h" | |||
#include "socket.h" | #include "socket.h" | |||
#include "record.h" | #include "record.h" | |||
#include "data.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 Parser; | class Parser; | |||
class Builder; | class Builder; | |||
class DBPacket; | class DBPacket; | |||
skipping to change at line 70 | skipping to change at line 71 | |||
{ | { | |||
friend class Barry::DBPacket; | friend class Barry::DBPacket; | |||
public: | public: | |||
/// Handheld mode type | /// Handheld mode type | |||
enum ModeType { | enum ModeType { | |||
Unspecified, //< default on start up | Unspecified, //< default on start up | |||
Bypass, //< unsupported, unknown | Bypass, //< unsupported, unknown | |||
Desktop, //< desktop mode required for databa se | Desktop, //< desktop mode required for databa se | |||
//< operation | //< operation | |||
JavaLoader //< unsupported | JavaLoader, //< unsupported | |||
UsbSerData //< GPRS modem support over USB | ||||
}; | }; | |||
enum CommandType { Unknown, DatabaseAccess }; | enum CommandType { Unknown, DatabaseAccess }; | |||
private: | private: | |||
Usb::Device m_dev; | Usb::Device m_dev; | |||
Usb::Interface *m_iface; | Usb::Interface *m_iface; | |||
uint32_t m_pin; | uint32_t m_pin; | |||
Socket m_socket; | Socket m_socket; | |||
CommandTable m_commandTable; | CommandTable m_commandTable; | |||
DatabaseDatabase m_dbdb; | DatabaseDatabase m_dbdb; | |||
ModeType m_mode; | ModeType m_mode; | |||
uint16_t m_modeSocket; // socket recommended by dev ice | uint16_t m_modeSocket; // socket recommended by dev ice | |||
// when mode was selected | // when mode was selected | |||
// UsbSerData cache | ||||
Data m_writeCache, m_readCache; | ||||
// tracking of open Desktop socket, and the need to reset | ||||
bool m_halfOpen; | ||||
protected: | protected: | |||
void SelectMode(ModeType mode); | void SelectMode(ModeType mode); | |||
unsigned int GetCommand(CommandType ct); | unsigned int GetCommand(CommandType ct); | |||
void LoadCommandTable(); | void LoadCommandTable(); | |||
void LoadDBDB(); | void LoadDBDB(); | |||
public: | public: | |||
Controller(const ProbeResult &device); | Controller(const ProbeResult &device); | |||
~Controller(); | ~Controller(); | |||
skipping to change at line 137 | skipping to change at line 145 | |||
void LoadDatabase(unsigned int dbId, Parser &parser); | void LoadDatabase(unsigned int dbId, Parser &parser); | |||
void SaveDatabase(unsigned int dbId, Builder &builder); | void SaveDatabase(unsigned int dbId, Builder &builder); | |||
template <class RecordT, class StorageT> void LoadDatabaseByType(Sto rageT &store); | template <class RecordT, class StorageT> void LoadDatabaseByType(Sto rageT &store); | |||
template <class RecordT, class StorageT> void SaveDatabaseByType(Sto rageT &store); | template <class RecordT, class StorageT> void SaveDatabaseByType(Sto rageT &store); | |||
template <class StorageT> void LoadDatabaseByName(const std::string &name, StorageT &store); | template <class StorageT> void LoadDatabaseByName(const std::string &name, StorageT &store); | |||
template <class StorageT> void SaveDatabaseByName(const std::string &name, StorageT &store); | template <class StorageT> void SaveDatabaseByName(const std::string &name, StorageT &store); | |||
template <class RecordT> void AddRecordByType(uint32_t recordId, con st RecordT &rec); | template <class RecordT> void AddRecordByType(uint32_t recordId, con st RecordT &rec); | |||
////////////////////////////////// | ||||
// UsbSerData mode - modem specific | ||||
void SerialRead(Data &data, int timeout); // can be called from sepa | ||||
rate thread | ||||
void SerialWrite(const Data &data); | ||||
}; | }; | |||
} // namespace Barry | } // namespace Barry | |||
#endif | #endif | |||
End of changes. 4 change blocks. | ||||
1 lines changed or deleted | 16 lines changed or added | |||
error.h | error.h | |||
---|---|---|---|---|
skipping to change at line 55 | skipping to change at line 55 | |||
// | // | |||
// BadPassword | // BadPassword | |||
// | // | |||
/// A bad or unknown password when talking to the device. | /// A bad or unknown password when talking to the device. | |||
/// Can be thrown in the following instances: | /// Can be thrown in the following instances: | |||
/// | /// | |||
/// - no password provided and the device requests one | /// - no password provided and the device requests one | |||
/// - device rejected the available password | /// - device rejected the available password | |||
/// - too few remaining tries left... Barry will refuse to keep | /// - too few remaining tries left... Barry will refuse to keep | |||
/// trying passwords if there are fewer than | /// trying passwords if there are fewer than | |||
/// 6 tries remaining | /// 6 tries remaining. In this case, out_of_tries() | |||
/// will return true. | ||||
/// | /// | |||
/// | /// | |||
class BadPassword : public Barry::Error | class BadPassword : public Barry::Error | |||
{ | { | |||
int m_remaining_tries; | int m_remaining_tries; | |||
bool m_out_of_tries; | ||||
public: | public: | |||
BadPassword(const std::string &str, int remaining_tries) | BadPassword(const std::string &str, int remaining_tries, | |||
bool out_of_tries) | ||||
: Barry::Error(str), | : Barry::Error(str), | |||
m_remaining_tries(remaining_tries) | m_remaining_tries(remaining_tries), | |||
m_out_of_tries(out_of_tries) | ||||
{} | {} | |||
int remaining_tries() const { return m_remaining_tries; } | int remaining_tries() const { return m_remaining_tries; } | |||
bool out_of_tries() const { return m_out_of_tries; } | ||||
}; | }; | |||
/// @} | /// @} | |||
} // namespace Barry | } // namespace Barry | |||
#endif | #endif | |||
End of changes. 5 change blocks. | ||||
3 lines changed or deleted | 8 lines changed or added | |||
record.h | record.h | |||
---|---|---|---|---|
skipping to change at line 222 | skipping to change at line 222 | |||
Province, | Province, | |||
PostalCode, | PostalCode, | |||
Country, | Country, | |||
Title, | Title, | |||
PublicKey, | PublicKey, | |||
Notes; | Notes; | |||
GroupLinksType GroupLinks; | GroupLinksType GroupLinks; | |||
UnknownsType Unknowns; | UnknownsType Unknowns; | |||
private: | ||||
bool m_FirstNameSeen; | ||||
//protected: | //protected: | |||
public: | public: | |||
const unsigned char* ParseField(const unsigned char *begin, | const unsigned char* ParseField(const unsigned char *begin, | |||
const unsigned char *end); | const unsigned char *end); | |||
public: | public: | |||
Contact(); | Contact(); | |||
~Contact(); | ~Contact(); | |||
uint32_t GetID() const { return RecordId; } | uint32_t GetID() const { return RecordId; } | |||
skipping to change at line 363 | skipping to change at line 366 | |||
//< MonthOfYear | //< MonthOfYear | |||
Week = 12 //< eg. every week on Mon and Fri | Week = 12 //< eg. every week on Mon and Fri | |||
//< set: WeekDays | //< set: WeekDays | |||
}; | }; | |||
bool Recurring; | bool Recurring; | |||
RecurringCodeType RecurringType; | RecurringCodeType RecurringType; | |||
unsigned short Interval; // must be >= 1 | unsigned short Interval; // must be >= 1 | |||
time_t RecurringEndTime; // only pertains if Recurring is tru e | time_t RecurringEndTime; // only pertains if Recurring is tru e | |||
// sets the date and time when | // sets the date and time when | |||
// recurrance of this appointment | // recurrence of this appointment | |||
// should no longer occur | // should no longer occur | |||
// If a perpetual appointment, this | // If a perpetual appointment, this | |||
// is 0xFFFFFFFF in the low level da ta | // is 0xFFFFFFFF in the low level da ta | |||
// Instead, set the following flag. | // Instead, set the following flag. | |||
bool Perpetual; // if true, this will always recur | bool Perpetual; // if true, this will always recur | |||
unsigned short TimeZoneCode; // the time zone originally used | unsigned short TimeZoneCode; // the time zone originally used | |||
// for the recurrance data... | // for the recurrence data... | |||
// seems to have little use, but | // seems to have little use, but | |||
// set to your current time zone | // set to your current time zone | |||
// as a good default | // as a good default | |||
unsigned short // recurring details, depending on t ype | unsigned short // recurring details, depending on t ype | |||
DayOfWeek, // 0-6 | DayOfWeek, // 0-6 | |||
WeekOfMonth, // 1-5 | WeekOfMonth, // 1-5 | |||
DayOfMonth, // 1-31 | DayOfMonth, // 1-31 | |||
MonthOfYear; // 1-12 | MonthOfYear; // 1-12 | |||
unsigned char WeekDays; // bitmask, bit 0 = sunday | unsigned char WeekDays; // bitmask, bit 0 = sunday | |||
skipping to change at line 397 | skipping to change at line 400 | |||
#define CAL_WD_THU 0x10 | #define CAL_WD_THU 0x10 | |||
#define CAL_WD_FRI 0x20 | #define CAL_WD_FRI 0x20 | |||
#define CAL_WD_SAT 0x40 | #define CAL_WD_SAT 0x40 | |||
// unknown | // unknown | |||
UnknownsType Unknowns; | UnknownsType Unknowns; | |||
public: | public: | |||
const unsigned char* ParseField(const unsigned char *begin, | const unsigned char* ParseField(const unsigned char *begin, | |||
const unsigned char *end); | const unsigned char *end); | |||
void ParseRecurranceData(const void *data); | void ParseRecurrenceData(const void *data); | |||
void BuildRecurranceData(void *data); | void BuildRecurrenceData(void *data); | |||
public: | public: | |||
Calendar(); | Calendar(); | |||
~Calendar(); | ~Calendar(); | |||
// Parser / Builder API (see parser.h / builder.h) | // Parser / Builder API (see parser.h / builder.h) | |||
uint8_t GetRecType() const { return RecType; } | uint8_t GetRecType() const { return RecType; } | |||
uint32_t GetUniqueId() const { return RecordId; } | uint32_t GetUniqueId() const { return RecordId; } | |||
void SetIds(uint8_t Type, uint32_t Id) { RecType = Type; RecordId = Id; } | void SetIds(uint8_t Type, uint32_t Id) { RecType = Type; RecordId = Id; } | |||
void ParseHeader(const Data &data, size_t &offset); | void ParseHeader(const Data &data, size_t &offset); | |||
End of changes. 4 change blocks. | ||||
4 lines changed or deleted | 7 lines changed or added | |||
socket.h | socket.h | |||
---|---|---|---|---|
skipping to change at line 90 | skipping to change at line 90 | |||
uint8_t GetZeroSocketSequence() const { return m_zeroSocketSequence; } | uint8_t GetZeroSocketSequence() const { return m_zeroSocketSequence; } | |||
void Open(uint16_t socket, const char *password = 0); | void Open(uint16_t socket, const char *password = 0); | |||
void Close(); | void Close(); | |||
// Send and Receive are available before Open... | // Send and Receive are available before Open... | |||
// an unopened socket defaults to socket 0, which you need | // an unopened socket defaults to socket 0, which you need | |||
// in order to set the blackberry mode | // in order to set the blackberry mode | |||
// The send function will overwrite the zeroSocketSequence byte | // The send function will overwrite the zeroSocketSequence byte | |||
// *inside* the packet, if the current m_socket is 0. | // *inside* the packet, if the current m_socket is 0. | |||
void Send(Data &send, Data &receive, int timeout = -1); | void Send(Data &send, int timeout = -1); // send only | |||
void Send(Data &send, Data &receive, int timeout = -1); // send+recv | ||||
void Send(Barry::Packet &packet, int timeout = -1); | void Send(Barry::Packet &packet, int timeout = -1); | |||
void Receive(Data &receive, int timeout = -1); | void Receive(Data &receive, int timeout = -1); | |||
// sends the send packet down to the device, fragmenting if | // sends the send packet down to the device, fragmenting if | |||
// necessary, and returns the response in receive, defragmenting | // necessary, and returns the response in receive, defragmenting | |||
// if needed | // if needed | |||
// Blocks until response received or timed out in Usb::Device | // Blocks until response received or timed out in Usb::Device | |||
void Packet(Data &send, Data &receive, int timeout = -1); | void Packet(Data &send, Data &receive, int timeout = -1); | |||
void Packet(Barry::Packet &packet, int timeout = -1); | void Packet(Barry::Packet &packet, int timeout = -1); | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 2 lines changed or added | |||
usbwrap.h | usbwrap.h | |||
---|---|---|---|---|
skipping to change at line 48 | skipping to change at line 48 | |||
/// \addtogroup exceptions | /// \addtogroup exceptions | |||
/// @{ | /// @{ | |||
/// Thrown on low level USB errors. | /// Thrown on low level USB errors. | |||
class Error : public Barry::Error | class Error : public Barry::Error | |||
{ | { | |||
public: | public: | |||
Error(const std::string &str) : Barry::Error(str) {} | Error(const std::string &str) : Barry::Error(str) {} | |||
}; | }; | |||
class Timeout : public Error | ||||
{ | ||||
public: | ||||
Timeout(const std::string &str) : Error(str) {} | ||||
}; | ||||
/// @} | /// @} | |||
/// Typedefs used by the wrapper class, in the hope to make it | /// Typedefs used by the wrapper class, in the hope to make it | |||
/// easier to switch from libusb stable to devel and back. | /// easier to switch from libusb stable to devel and back. | |||
typedef struct usb_device* DeviceIDType; | typedef struct usb_device* DeviceIDType; | |||
typedef struct usb_dev_handle* DeviceHandleType; | typedef struct usb_dev_handle* DeviceHandleType; | |||
class Match | class Match | |||
{ | { | |||
private: | private: | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 6 lines changed or added | |||