Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef __BARRY_RECORD_CALLLOG_H__
00024 #define __BARRY_RECORD_CALLLOG_H__
00025
00026 #include "dll.h"
00027 #include "record.h"
00028 #include <vector>
00029 #include <string>
00030 #include <stdint.h>
00031
00032 namespace Barry {
00033
00034
00035 class IConverter;
00036
00037 class BXEXPORT CallLog
00038 {
00039 public:
00040 typedef Barry::UnknownsType UnknownsType;
00041
00042 uint8_t RecType;
00043 uint32_t RecordId;
00044
00045 uint32_t Duration;
00046 uint64_t Timestamp;
00047
00048
00049 std::string ContactName;
00050 std::string PhoneNumber;
00051
00052 enum DirectionFlagType
00053 {
00054 Receiver = 0,
00055 Emitter,
00056 Failed,
00057
00058
00059 Missing
00060
00061
00062 };
00063 DirectionFlagType DirectionFlag;
00064
00065 enum StatusFlagType
00066 {
00067 OK = 0,
00068 Busy,
00069
00070 NetError,
00071 Unknown
00072 };
00073 StatusFlagType StatusFlag;
00074
00075 enum PhoneTypeFlagType
00076 {
00077 TypeUndefined = 0,
00078 TypeOffice,
00079 TypeHome,
00080 TypeMobile,
00081 TypeUnknown
00082 };
00083 PhoneTypeFlagType PhoneTypeFlag;
00084
00085 enum PhoneInfoFlagType
00086 {
00087 InfoUndefined = 0,
00088 InfoKnown,
00089 InfoUnknown,
00090 InfoPrivate
00091 };
00092 PhoneInfoFlagType PhoneInfoFlag;
00093
00094 UnknownsType Unknowns;
00095
00096 protected:
00097 time_t GetTime() const;
00098
00099 static DirectionFlagType DirectionProto2Rec(uint8_t s);
00100 static uint8_t DirectionRec2Proto(DirectionFlagType s);
00101
00102 static PhoneTypeFlagType PhoneTypeProto2Rec(uint8_t s);
00103 static uint8_t PhoneTypeRec2Proto(PhoneTypeFlagType s);
00104
00105 public:
00106 CallLog();
00107 ~CallLog();
00108
00109
00110 const unsigned char* ParseField(const unsigned char *begin,
00111 const unsigned char *end, const IConverter *ic = 0);
00112 uint8_t GetRecType() const { return RecType; }
00113 uint32_t GetUniqueId() const { return RecordId; }
00114 void SetIds(uint8_t Type, uint32_t Id) { RecType = Type; RecordId = Id; }
00115 void ParseHeader(const Data &data, size_t &offset);
00116 void ParseFields(const Data &data, size_t &offset, const IConverter *ic = 0);
00117
00118 void Clear();
00119
00120 void Dump(std::ostream &os) const;
00121
00122
00123 bool operator<(const CallLog &other) const { return Timestamp < other.Timestamp; }
00124
00125
00126 static const char * GetDBName() { return "Phone Call Logs"; }
00127 static uint8_t GetDefaultRecType() { return 0; }
00128 };
00129
00130 BXEXPORT inline std::ostream& operator<<(std::ostream &os, const CallLog &msg) {
00131 msg.Dump(os);
00132 return os;
00133 }
00134
00135 }
00136
00137 #endif
00138