File: AGPalmProtocol.c

package info (click to toggle)
malsync 2.0.6-4
  • links: PTS
  • area: main
  • in suites: woody
  • size: 2,212 kB
  • ctags: 2,029
  • sloc: ansic: 18,353; cpp: 430; makefile: 114; perl: 30
file content (82 lines) | stat: -rw-r--r-- 2,340 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/* The contents of this file are subject to the Mozilla Public License
 * Version 1.0 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
 * License for the specific language governing rights and limitations
 * under the License.
 *
 * The Original Code is Mobile Application Link.
 *
 * The Initial Developer of the Original Code is AvantGo, Inc.
 * Portions created by AvantGo, Inc. are Copyright (C) 1997-1999
 * AvantGo, Inc. All Rights Reserved.
 *
 * Contributor(s):
 */

#include <AGPalmProtocol.h>

//PENDING(klobad) see the pendings in the .h

ExportFunc void AGPalmWriteDBConfigPlatformData(AGWriter *w, 
                                    uint32 creator, uint32 type, uint32 flags)
{
    AGWriteCompactInt((AGWriter *)w, creator);
    AGWriteCompactInt((AGWriter *)w, type);
    AGWriteCompactInt((AGWriter *)w, flags);
}

ExportFunc void AGPalmReadDBConfigPlatformData(AGReader *r, 
                                    uint32 *creator, uint32 *type, uint32 *flags)
{
    *creator = AGReadCompactInt(r);
    *type = AGReadCompactInt(r);
    *flags = AGReadCompactInt(r);
}

ExportFunc void AGPalmWriteRecordPlatformData(AGWriter *w, int16 recordIndex)
{
    AGWriteInt16(w, recordIndex);
}

ExportFunc void AGPalmReadRecordPlatformData(AGReader *r, int16 *recordIndex)
{
    *recordIndex = AGReadInt16(r);
}

ExportFunc void AGPalmWriteDeviceInfoPlatformData(AGWriter *w)
{

}

ExportFunc void AGPalmReadDeviceInfoPlatformData(AGReader *r)
{

}

ExportFunc uint8 AGPalmMALModToPilotAttribs(AGRecordStatus mod)
{
    uint8 ret = 0;

	// These values are found from [palm includes]\System\DataMgr.h
    ret |= (mod == AG_RECORD_UNMODIFIED)    ? 0x00 : 0; //duh
    ret |= (mod == AG_RECORD_UPDATED)       ? 0x40 : 0;
    ret |= (mod == AG_RECORD_NEW)           ? 0x40 : 0;
    ret |= (mod == AG_RECORD_DELETED)       ? 0x80 : 0;
    
    return ret;    
}

ExportFunc AGRecordStatus AGPalmPilotAttribsToMALMod(uint8 attrib)
{
    if (attrib & 0x80)
        return AG_RECORD_DELETED;
    if (attrib & 0x40)
        return AG_RECORD_UPDATED;

    return AG_RECORD_UNMODIFIED;
}