3 // Container / environment class for the sync module.
7 Copyright (C) 2006-2010, Net Direct Inc. (http://www.netdirect.ca/)
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU General Public License in the COPYING file at the
19 root directory of this project for more details.
22 #ifndef __BARRY_SYNC_ENVIRONMENT_H__
23 #define __BARRY_SYNC_ENVIRONMENT_H__
25 #include <opensync/opensync.h>
26 #include <barry/barry.h>
32 struct DatabaseSyncState
35 // cache is a map of record ID to bool... the bool doesn't mean
36 // anything... the mere existence of the ID means it belongs
38 typedef std::map
<uint32_t, bool> cache_type
;
42 std::string m_CacheFilename
;
46 std::string m_MapFilename
;
52 Barry::RecordStateTable m_Table
;
60 DatabaseSyncState(OSyncMember
*pm
, const char *description
);
70 void ClearDirtyFlags();
72 std::string
Map2Uid(uint32_t recordId
) const;
73 unsigned long GetMappedRecordId(const std::string
&uid
);
77 struct BarryEnvironment
83 std::string m_ConfigData
;
86 std::string m_password
;
88 // device communication
89 Barry::IConverter m_IConverter
;
90 std::auto_ptr
<Barry::ProbeResult
> m_ProbeResult
;
91 Barry::Controller
*m_pCon
;
92 Barry::Mode::Desktop
*m_pDesktop
;
95 DatabaseSyncState m_CalendarSync
, m_ContactsSync
;
101 BarryEnvironment(OSyncMember
*pm
);
104 void Connect(const Barry::ProbeResult
&result
);
108 DatabaseSyncState
* GetSyncObject(OSyncChange
*change
);
110 void ParseConfig(const char *data
, int size
);
113 void ClearDirtyFlags(Barry::RecordStateTable
&table
, const std::string
&dbname
);
114 void ClearCalendarDirtyFlags();
115 void ClearContactsDirtyFlags();