3 // Container / environment class for the sync module.
7 Copyright (C) 2006-2007, 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>
31 struct DatabaseSyncState
34 // cache is a map of record ID to bool... the bool doesn't mean
35 // anything... the mere existence of the ID means it belongs
37 typedef std::map
<uint32_t, bool> cache_type
;
41 std::string m_CacheFilename
;
45 std::string m_MapFilename
;
51 Barry::RecordStateTable m_Table
;
59 DatabaseSyncState(OSyncMember
*pm
, const char *description
);
69 void ClearDirtyFlags();
71 std::string
Map2Uid(uint32_t recordId
) const;
72 unsigned long GetMappedRecordId(const std::string
&uid
);
76 struct BarryEnvironment
82 std::string m_ConfigData
;
86 // device communication
87 Barry::ProbeResult m_ProbeResult
;
88 Barry::Controller
*m_pCon
;
91 DatabaseSyncState m_CalendarSync
, m_ContactsSync
;
97 BarryEnvironment(OSyncMember
*pm
);
100 void Connect(const Barry::ProbeResult
&result
);
104 DatabaseSyncState
* GetSyncObject(OSyncChange
*change
);
106 void ParseConfig(const char *data
, int size
);
109 void ClearDirtyFlags(Barry::RecordStateTable
&table
, const std::string
&dbname
);
110 void ClearCalendarDirtyFlags();
111 void ClearContactsDirtyFlags();