The main interface class to the device databases. More...
#include <m_desktop.h>
Public Member Functions | |
const DatabaseDatabase & | GetDBDB () const |
Returns DatabaseDatabase object for this connection. | |
unsigned int | GetDBID (const std::string &name) const |
Get numeric database ID by name. | |
unsigned int | GetDBCommand (CommandType ct) |
Get database command from command table. | |
void | GetRecordStateTable (unsigned int dbId, RecordStateTable &result) |
Retrieve the record state table from the handheld device, using the given database ID. | |
void | AddRecord (unsigned int dbId, Builder &build) |
Adds a record to the specified database. | |
void | GetRecord (unsigned int dbId, unsigned int stateTableIndex, Parser &parser) |
Retrieves a specific record from the specified database. | |
void | SetRecord (unsigned int dbId, unsigned int stateTableIndex, Builder &build) |
Overwrites a specific record in the device as identified by the stateTableIndex. | |
void | ClearDirty (unsigned int dbId, unsigned int stateTableIndex) |
Clears the dirty flag on the specified record in the specified database. | |
void | DeleteRecord (unsigned int dbId, unsigned int stateTableIndex) |
Deletes the specified record in the specified database. | |
void | LoadDatabase (unsigned int dbId, Parser &parser) |
Retrieve a database from the handheld device, using the given parser to parse the resulting data, and optionally store it. |
The main interface class to the device databases.
To use this class, use the following steps:
Definition at line 54 of file m_desktop.h.
void Barry::Mode::Desktop::AddRecord | ( | unsigned int | dbId, | |
Builder & | build | |||
) |
Adds a record to the specified database.
RecordId is retrieved from build, and duplicate IDs are allowed by the device (i.e. you can have two records with the same ID) but *not* recommended!
Definition at line 214 of file m_desktop.cc.
References Barry::Packet::Command(), and Barry::DBPacket::SetRecord().
void Barry::Mode::Desktop::ClearDirty | ( | unsigned int | dbId, | |
unsigned int | stateTableIndex | |||
) |
Clears the dirty flag on the specified record in the specified database.
Definition at line 335 of file m_desktop.cc.
References Barry::Packet::Command(), and Barry::DBPacket::SetRecordFlags().
void Barry::Mode::Desktop::DeleteRecord | ( | unsigned int | dbId, | |
unsigned int | stateTableIndex | |||
) |
Deletes the specified record in the specified database.
Definition at line 355 of file m_desktop.cc.
References Barry::Packet::Command(), and Barry::DBPacket::DeleteRecordByIndex().
unsigned int Barry::Mode::Desktop::GetDBCommand | ( | CommandType | ct | ) |
Get database command from command table.
Must call Open() before this.
Definition at line 151 of file m_desktop.cc.
Referenced by Barry::DBPacket::ClearDatabase(), Barry::DBPacket::DeleteRecordByIndex(), Barry::DBPacket::GetDBDB(), Barry::DBPacket::GetRecordByIndex(), Barry::DBPacket::GetRecords(), Barry::DBPacket::GetRecordStateTable(), Barry::DBPacket::SetRecord(), Barry::DBPacket::SetRecordByIndex(), and Barry::DBPacket::SetRecordFlags().
const DatabaseDatabase& Barry::Mode::Desktop::GetDBDB | ( | ) | const [inline] |
Returns DatabaseDatabase object for this connection.
Must call Open() first, which loads the DBDB.
Definition at line 85 of file m_desktop.h.
unsigned int Barry::Mode::Desktop::GetDBID | ( | const std::string & | name | ) | const |
Get numeric database ID by name.
[in] | name | Name of database, which matches one of the names listed in GetDBDB() |
Barry::Error | Thrown if name not found. |
Definition at line 135 of file m_desktop.cc.
void Barry::Mode::Desktop::GetRecord | ( | unsigned int | dbId, | |
unsigned int | stateTableIndex, | |||
Parser & | parser | |||
) |
Retrieves a specific record from the specified database.
The stateTableIndex comes from the GetRecordStateTable() function. GetRecord() does not clear the dirty flag.
Definition at line 250 of file m_desktop.cc.
References Barry::Packet::Command(), Barry::DBPacket::GetRecordByIndex(), and Barry::DBPacket::Parse().
void Barry::Mode::Desktop::GetRecordStateTable | ( | unsigned int | dbId, | |
RecordStateTable & | result | |||
) |
Retrieve the record state table from the handheld device, using the given database ID.
Results will be stored in result, which will be cleared before adding.
Definition at line 187 of file m_desktop.cc.
References Barry::Packet::Command(), and Barry::DBPacket::GetRecordStateTable().
void Barry::Mode::Desktop::LoadDatabase | ( | unsigned int | dbId, | |
Parser & | parser | |||
) |
Retrieve a database from the handheld device, using the given parser to parse the resulting data, and optionally store it.
See the RecordParser<> template to create a parser object. The RecordParser<> template allows custom storage based on the type of database record retrieved. The database ID and the parser Record type must match.
[in] | dbId | Database Database ID - use GetDBID() |
[out] | parser | Parser object which parses the resulting protocol data, and optionally stores it in a custom fashion. See the RecordParser<> template. |
Barry::Error | Thrown on protocol error. | |
std::logic_error | Thrown if not in Desktop mode. |
Definition at line 393 of file m_desktop.cc.
References Barry::Packet::Command(), Barry::DBPacket::GetRecords(), and Barry::DBPacket::Parse().
void Barry::Mode::Desktop::SetRecord | ( | unsigned int | dbId, | |
unsigned int | stateTableIndex, | |||
Builder & | build | |||
) |
Overwrites a specific record in the device as identified by the stateTableIndex.
Definition at line 298 of file m_desktop.cc.
References Barry::Packet::Command(), and Barry::DBPacket::SetRecordByIndex().