[conduit/syncml: 1/244] First stage of syncml support



commit a99ad6fe66dd8d90dcb6040a44f321dcc381aab3
Author: John Carr <john carr unrouted co uk>
Date:   Thu Apr 2 08:22:05 2009 -0700

    First stage of syncml support
---
 conduit/dataproviders/BluetoothFactory.py    |   51 ++++++
 conduit/modules/SyncmlModule/SyncmlModule.py |  118 +++++++++++++
 conduit/modules/SyncmlModule/enums.py        |   86 +++++++++
 conduit/modules/SyncmlModule/pysyncml.py     |  242 ++++++++++++++++++++++++++
 4 files changed, 497 insertions(+), 0 deletions(-)

diff --git a/conduit/dataproviders/BluetoothFactory.py b/conduit/dataproviders/BluetoothFactory.py
new file mode 100644
index 0000000..1de33c2
--- /dev/null
+++ b/conduit/dataproviders/BluetoothFactory.py
@@ -0,0 +1,51 @@
+import gobject
+import dbus
+
+import conduit.dataproviders.SimpleFactory as SimpleFactory
+
+class BluetoothFactory(SimpleFactory.SimpleFactory):
+
+    def __init__(self, **kwargs):
+        SimpleFactory.SimpleFactory.__init__(self, **kwargs)
+
+        self.bus = dbus.SystemBus()
+        self.bluez = dbus.Interface(self.bus.get_object("org.bluez", "/"), "org.bluez.Manager")
+
+        adapter_path = self.bluez.DefaultAdapter()
+        self.adapter = dbus.Interface(self.bus.get_object("org.bluez", adapter_path), "org.bluez.Adapter")
+
+        self.adapter.connect_to_signal("DeviceCreated", self._device_created)
+        # self.adapter.connect_to_signal("DeviceRemoved", self._device_removed)
+
+        # FIXME: Need to listen to property changes and not show paired devices?
+
+    def _maybe_new(self, device):
+        properties = device.GetProperties()
+
+        props = {}
+        props['Name'] = str(properties['Name'])
+        props['Alias'] = str(properties['Alias'])
+        props['Address'] = str(properties['Address'])
+        props['Paired'] = bool(properties['Paired'])
+        props['Connected'] = bool(properties['Connected'])
+        props['Trusted'] = bool(properties['Trusted'])
+        props['Object'] = device
+
+        if self.is_interesting(props['Address'], props):
+            self.item_added(props['Address'], **props)
+
+    def _device_created(self, device_path):
+        device = dbus.Interface(self.bus.get_object("org.bluez", device_path), "org.bluez.Device")
+        self._maybe_new(device)
+
+    def probe(self):
+        for device_path in self.adapter.ListDevices():
+            device = dbus.Interface(self.bus.get_object("org.bluez", device_path), "org.bluez.Device")
+            self._maybe_new(device) 
+
+    def get_args(self, id, **kwargs):
+        return (id, )
+
+    def is_interesting(self, address, props):
+        return props['Paired'] == true
+
diff --git a/conduit/modules/SyncmlModule/SyncmlModule.py b/conduit/modules/SyncmlModule/SyncmlModule.py
new file mode 100644
index 0000000..4e5866f
--- /dev/null
+++ b/conduit/modules/SyncmlModule/SyncmlModule.py
@@ -0,0 +1,118 @@
+import conduit.utils as Utils
+import conduit.dataproviders.DataProvider as DataProvider
+import conduit.dataproviders.DataProviderCategory as DataProviderCategory
+import conduit.dataproviders.BluetoothFactory as BluetoothFactory
+
+try:
+    import pysyncml
+except ImportError:
+    Utils.dataprovider_add_dir_to_path(__file__)
+    import pysyncml
+import enums
+
+MODULES = {
+    "BluetoothSyncmlFactory": { "type": "dataprovider-factory"},
+}
+
+
+class BluetoothSyncmlFactory(BluetoothFactory.BluetoothFactory):
+
+    def is_interesting(self, id, props):
+        return True
+
+    def get_category(self, id, **props):
+        return DataProviderCategory.DataProviderCategory(
+            props.get("Name", "Bluetooth Device"),
+            "phone",
+            id)
+
+    def get_dataproviders(self, id, **props):
+        return [
+            ContactsProvider
+        ]
+
+
+class SyncmlDataProvider(DataProvider.TwoWay):
+
+    def handle_event(self, sync_object, event, userdata, err):
+        if event == enums.SML_DATA_SYNC_EVENT_ERROR:
+            print "ERRROR"
+        elif event == enums.SML_DATA_SYNC_EVENT_CONNECT:
+            print "Connect"
+        elif event == enums.SML_DATA_SYNC_EVENT_GOT_ALL_ALERTS:
+            print "Got all alerts"
+        elif event == enums.SML_DATA_SYNC_EVENT_GOT_ALL_CHANGES:
+            print "Got All Changes"
+        elif event == enums.SML_DATA_SYNC_EVENT_GOT_ALL_MAPPINGS:
+            print "Got All Mappings"
+        elif event == enums.SML_DATA_SYNC_EVENT_DISCONNECT:
+            print "Disconnect"
+        elif event == enums.SML_DATA_SYNC_EVENT_FINISHED:
+            print "Finished"
+        else:
+            print "Unexpected error"
+
+    def handle_change(self, sync_object, source, type, uid, data, size, userdata, err):
+        if type == enums.SML_CHANGE_ADD:
+            pass
+        elif type == enums.SML_CHANGE_REPLACE:
+            pass
+        elif type == enums.SML_CHANGE_DELETE:
+            pass
+        print "CHANGE CHANGE CHANGE"
+        return 1
+
+    def handle_devinf(self, sync_object, info, userdata, err):
+        print "DEVINF!"
+        return 1
+
+    def __init__(self, address):
+        DataProvider.TwoWay.__init__(self)
+        self.address = address
+
+        self._handle_event = pysyncml.EventCallback(self.handle_event)
+        self._handle_change = pysyncml.ChangeCallback(self.handle_change)
+        self._handle_devinf = pysyncml.HandleRemoteDevInfCallback(self.handle_devinf)
+
+    def refresh(self):
+        err = pysyncml.Error()
+        self.syncobj = pysyncml.SyncObject.new(enums.SML_SESSION_TYPE_SERVER, enums.SML_TRANSPORT_OBEX_CLIENT, pysyncml.byref(err))
+
+        self.syncobj.set_option(enums.SML_DATA_SYNC_CONFIG_CONNECTION_TYPE, enums.SML_DATA_SYNC_CONFIG_CONNECTION_BLUETOOTH, pysyncml.byref(err))
+        self.syncobj.set_option(enums.SML_TRANSPORT_CONFIG_BLUETOOTH_ADDRESS, self.address, pysyncml.byref(err))
+        self.syncobj.set_option(enums.SML_TRANSPORT_CONFIG_BLUETOOTH_CHANNEL, "10", pysyncml.byref(err))
+
+        self.syncobj.set_option(enums.SML_DATA_SYNC_CONFIG_IDENTIFIER, "PC Suite", pysyncml.byref(err))
+        self.syncobj.set_option(enums.SML_DATA_SYNC_CONFIG_USE_WBXML, "1", pysyncml.byref(err))
+
+        self.syncobj.add_datastore("text/x-vcard", None, "Contacts", pysyncml.byref(err))
+
+        self.syncobj.register_event_callback(self._handle_event, None)
+        self.syncobj.register_change_callback(self._handle_change, None)
+        self.syncobj.register_handle_remote_devinf_callback(self._handle_devinf, None)
+
+        if not self.syncobj.init(pysyncml.byref(err)):
+            print "FAIL!!!"
+            return
+
+        if not self.syncobj.run(pysyncml.byref(err)):
+            print "RUN FAIL!!!"
+            return
+        print "running..."
+
+    def get_all(self):
+        return []
+
+    def get_UID(self):
+        return self.address
+
+class ContactsProvider(SyncmlDataProvider):
+
+    _name_ = "Contacts"
+    _description_ = "Contacts"
+    _module_type_ = "twoway"
+    _in_type_ = "contact"
+    _out_type_ = "contact"
+    _icon_ = "contact-new"
+    _configurable_ = False
+    
diff --git a/conduit/modules/SyncmlModule/enums.py b/conduit/modules/SyncmlModule/enums.py
new file mode 100644
index 0000000..559053b
--- /dev/null
+++ b/conduit/modules/SyncmlModule/enums.py
@@ -0,0 +1,86 @@
+SML_TRANSPORT_CONFIG_PROXY = "PROXY"
+SML_TRANSPORT_CONFIG_USERNAME = "USERNAME"
+SML_TRANSPORT_CONFIG_PASSWORD = "PASSWORD"
+SML_TRANSPORT_CONFIG_SSL_CA_FILE = "SSL_CA_FILE"
+SML_TRANSPORT_CONFIG_PORT = "PORT"
+SML_TRANSPORT_CONFIG_URL = "URL"
+SML_TRANSPORT_CONFIG_SSL_KEY = "SSL_KEY"
+SML_TRANSPORT_CONFIG_SSL_SERVER_CERT = "SSL_SERVER_CERT"
+SML_TRANSPORT_CONFIG_BLUETOOTH_ADDRESS = "BLUETOOTH_ADDRESS"
+SML_TRANSPORT_CONFIG_BLUETOOTH_CHANNEL = "BLUETOOTH_CHANNEL"
+SML_TRANSPORT_CONFIG_IRDA_SERVICE = "IRDA_SERVICE"
+SML_TRANSPORT_CONFIG_AT_COMMAND = "AT_COMMAND"
+SML_TRANSPORT_CONFIG_AT_MANUFACTURER = "AT_MANUFACTURER"
+SML_TRANSPORT_CONFIG_AT_MODEL = "AT_MODEL"
+SML_TRANSPORT_CONFIG_DATASTORE = "DATASTORE"
+SML_TRANSPORT_CONFIG_DATASTORE_EVENT = "EVENT"
+SML_TRANSPORT_CONFIG_DATASTORE_TODO = "TODO"
+SML_TRANSPORT_CONFIG_DATASTORE_CONTACT = "CONTACT"
+SML_TRANSPORT_CONFIG_DATASTORE_NOTE = "NOTE"
+SML_DEVINF_DEVTYPE_UNKNOWN = 0
+SML_DEVINF_DEVTYPE_PAGER = 1
+SML_DEVINF_DEVTYPE_HANDHELD = 2
+SML_DEVINF_DEVTYPE_PDA = 3
+SML_DEVINF_DEVTYPE_PHONE = 4
+SML_DEVINF_DEVTYPE_SMARTPHONE = 5
+SML_DEVINF_DEVTYPE_SERVER = 6
+SML_DEVINF_DEVTYPE_WORKSTATION = 7
+SML_DATA_SYNC_CONFIG_CONNECTION_TYPE = "CONNECTION_TYPE"
+SML_DATA_SYNC_CONFIG_CONNECTION_SERIAL = "SERIAL"
+SML_DATA_SYNC_CONFIG_CONNECTION_BLUETOOTH = "BLUETOOTH"
+SML_DATA_SYNC_CONFIG_CONNECTION_IRDA = "IRDA"
+SML_DATA_SYNC_CONFIG_CONNECTION_NET = "NET"
+SML_DATA_SYNC_CONFIG_CONNECTION_USB = "USB"
+SML_DATA_SYNC_CONFIG_AUTH_USERNAME = "USERNAME"
+SML_DATA_SYNC_CONFIG_AUTH_PASSWORD = "PASSWORD"
+SML_DATA_SYNC_CONFIG_AUTH_TYPE = "AUTH_TYPE"
+SML_DATA_SYNC_CONFIG_AUTH_BASIC = "AUTH_BASIC"
+SML_DATA_SYNC_CONFIG_AUTH_NONE = "AUTH_NONE"
+SML_DATA_SYNC_CONFIG_AUTH_MD5 = "AUTH_MD5"
+SML_DATA_SYNC_CONFIG_VERSION = "VERSION"
+SML_DATA_SYNC_CONFIG_IDENTIFIER = "IDENTIFIER"
+SML_DATA_SYNC_CONFIG_USE_WBXML = "USE_WBXML"
+SML_DATA_SYNC_CONFIG_USE_STRING_TABLE = "USE_STRING_TABLE"
+SML_DATA_SYNC_CONFIG_USE_TIMESTAMP_ANCHOR = "USE_TIMESTAMP_ANCHOR"
+SML_DATA_SYNC_CONFIG_USE_NUMBER_OF_CHANGES = "USE_NUMBER_OF_CHANGES"
+SML_DATA_SYNC_CONFIG_USE_LOCALTIME = "USE_LOCALTIME"
+SML_DATA_SYNC_CONFIG_ONLY_REPLACE = "ONLY_REPLACE"
+SML_DATA_SYNC_CONFIG_MAX_MSG_SIZE = "MAX_MSG_SIZE"
+SML_DATA_SYNC_CONFIG_MAX_OBJ_SIZE = "MAX_OBJ_SIZE"
+SML_DATA_SYNC_CONFIG_FAKE_DEVICE = "FAKE_DEVICE"
+SML_DATA_SYNC_CONFIG_FAKE_MANUFACTURER = "FAKE_MANUFACTURER"
+SML_DATA_SYNC_CONFIG_FAKE_MODEL = "FAKE_MODEL"
+SML_DATA_SYNC_CONFIG_FAKE_SOFTWARE_VERSION = "FAKE_SOFTWARE_VERSION"
+SML_DATA_SYNC_EVENT_ERROR = 0
+SML_DATA_SYNC_EVENT_CONNECT = 1
+SML_DATA_SYNC_EVENT_GOT_ALL_ALERTS = 2
+SML_DATA_SYNC_EVENT_GOT_ALL_CHANGES = 3
+SML_DATA_SYNC_EVENT_GOT_ALL_MAPPINGS = 4
+SML_DATA_SYNC_EVENT_DISCONNECT = 5
+SML_DATA_SYNC_EVENT_FINISHED = 6
+SML_SESSION_TYPE_SERVER = 0
+SML_SESSION_TYPE_CLIENT = 1
+SML_TRANSPORT_OBEX_CLIENT = 2
+SML_TRANSPORT_OBEX_SERVER = 3
+SML_TRANSPORT_HTTP_CLIENT = 1
+SML_TRANSPORT_HTTP_SERVER = 0
+SML_ALERT_UNKNOWN = 0
+SML_ALERT_DISPLAY = 100
+SML_ALERT_TWO_WAY = 200
+SML_ALERT_SLOW_SYNC = 201
+SML_ALERT_ONE_WAY_FROM_CLIENT = 202
+SML_ALERT_REFRESH_FROM_CLIENT = 203
+SML_ALERT_ONE_WAY_FROM_SERVER = 204
+SML_ALERT_REFRESH_FROM_SERVER = 205
+SML_ALERT_TWO_WAY_BY_SERVER = 206
+SML_ALERT_ONE_WAY_FROM_CLIENT_BY_SERVER = 207
+SML_ALERT_REFRESH_FROM_CLIENT_BY_SERVER = 208
+SML_ALERT_ONE_WAY_FROM_SERVER_BY_SERVER = 209
+SML_ALERT_REFRESH_FROM_SERVER_BY_SERVER = 210
+SML_ALERT_RESULT = 221
+SML_ALERT_NEXT_MESSAGE = 222
+SML_ALERT_NO_END_OF_DATA = 223
+SML_CHANGE_UNKNOWN = 0
+SML_CHANGE_ADD = 1
+SML_CHANGE_REPLACE = 2
+SML_CHANGE_DELETE = 3
diff --git a/conduit/modules/SyncmlModule/pysyncml.py b/conduit/modules/SyncmlModule/pysyncml.py
new file mode 100644
index 0000000..067021f
--- /dev/null
+++ b/conduit/modules/SyncmlModule/pysyncml.py
@@ -0,0 +1,242 @@
+from ctypes import *
+
+lib = CDLL('libsyncml.so')
+
+def instancemethod(method):
+    def _(self, *args, **kwargs):
+        return method(self, *args, **kwargs)
+    return _
+
+class DataStore(c_void_p):
+
+    new = staticmethod(lib.smlDevInfDataStoreNew)
+    get_source_ref = instancemethod(lib.smlDevInfDataStoreGetSourceRef)
+    set_source_ref = instancemethod(lib.smlDevInfDataStoreSetSourceRef)
+    source_ref = property(fget=get_source_ref, fset=set_source_ref)
+    get_display_name = instancemethod(lib.smlDevInfDataStoreGetDisplayName)
+    set_display_name = instancemethod(lib.smlDevInfDataStoreSetDisplayName)
+    display_name = property(fget=get_display_name, fset=set_display_name)
+    get_max_guid_size = instancemethod(lib.smlDevInfGetMaxGUIDSize)
+    set_max_guid_size = instancemethod(lib.smlDevInfSetMaxGUIDSize)
+    max_guid_size = property(fget=get_max_guid_size, fset=set_max_guid_size)
+
+
+class Info(c_void_p):
+
+    new = staticmethod(lib.smlDevInfNew)
+    add_datastore = instancemethod(lib.smlDevInfAddDataStore)
+    num_datastores = instancemethod(lib.smlDevInfNumDataStores)
+    get_nth_datastore = instancemethod(lib.smlDevInfGetNthDataStore)
+    get_manufacturer = instancemethod(lib.smlDevInfGetManufacturer)
+    set_manufacturer = instancemethod(lib.smlDevInfSetManufacturer)
+    manufacturer = property(fget=get_manufacturer, fset=set_manufacturer)
+    get_model = instancemethod(lib.smlDevInfGetModel)
+    set_model = instancemethod(lib.smlDevInfSetModel)
+    model = property(fget=get_model, fset=set_model)
+    get_oem = instancemethod(lib.smlDevInfGetOEM)
+    set_oem = instancemethod(lib.smlDevInfSetOEM)
+    oem = property(fget=get_oem, fset=set_oem)
+    get_firmware_version = instancemethod(lib.smlDevInfGetFirmwareVersion)
+    set_firmware_version = instancemethod(lib.smlDevInfSetFirmwareVersion)
+    firmware_version = property(fget=get_firmware_version, fset=set_firmware_version)
+    get_software_version = instancemethod(lib.smlDevInfGetSoftwareVersion)
+    set_software_version = instancemethod(lib.smlDevInfSetSoftwareVersion)
+    software_version = property(fget=get_software_version, fset=set_software_version)
+    get_hardware_version = instancemethod(lib.smlDevInfGetHardwareVersion)
+    set_hardware_version = instancemethod(lib.smlDevInfSetHardwareVersion)
+    hardware_version = property(fget=get_hardware_version, fset=set_hardware_version)
+    get_device_id = instancemethod(lib.smlDevInfGetDeviceID)
+    set_device_id = instancemethod(lib.smlDevInfSetDeviceID)
+    device_id = property(fget=get_device_id, fset=set_device_id)
+    get_device_type = instancemethod(lib.smlDevInfGetDeviceType)
+    set_device_type = instancemethod(lib.smlDevInfSetDeviceType)
+    device_type = property(fget=get_device_type, fset=set_device_type)
+    get_supports_utc = instancemethod(lib.smlDevInfSupportsUTC)
+    set_supports_utc = instancemethod(lib.smlDevInfSetSupportsUTC)
+    supports_utc = property(fget=get_supports_utc, fset=set_supports_utc)
+    get_supports_large_objs = instancemethod(lib.smlDevInfSupportsLargeObjs)
+    set_supports_large_objs = instancemethod(lib.smlDevInfSetSupportsLargeObjs)
+    supports_large_objs = property(fget=get_supports_large_objs, fset=set_supports_large_objs)
+    get_supports_num_changes = instancemethod(lib.smlDevInfSupportsNumberOfChanges)
+    set_supports_num_changes = instancemethod(lib.smlDevInfSetSupportsNumberOfChanges)
+    supports_num_changes = property(fget=get_supports_num_changes, fset=set_supports_num_changes)
+
+
+class SyncObject(c_void_p):
+
+    unref = lib.smlDataSyncObjectUnref
+    new = staticmethod(lib.smlDataSyncNew)
+    set_option = instancemethod(lib.smlDataSyncSetOption)
+    add_datastore = instancemethod(lib.smlDataSyncAddDatastore)
+    init = instancemethod(lib.smlDataSyncInit)
+    run = instancemethod(lib.smlDataSyncRun)
+    add_change = instancemethod(lib.smlDataSyncAddChange)
+    send_changes = instancemethod(lib.smlDataSyncSendChanges)
+    add_mapping = instancemethod(lib.smlDataSyncAddMapping)
+    get_target = instancemethod(lib.smlDataSyncGetTarget)
+    register_event_callback = instancemethod(lib.smlDataSyncRegisterEventCallback)
+    register_get_alert_type_callback = instancemethod(lib.smlDataSyncRegisterGetAlertTypeCallback)
+    register_change_callback = instancemethod(lib.smlDataSyncRegisterChangeCallback)
+    register_get_anchor_callback = instancemethod(lib.smlDataSyncRegisterGetAnchorCallback)
+    register_set_anchor_callback = instancemethod(lib.smlDataSyncRegisterSetAnchorCallback)
+    register_write_devinf_callback = instancemethod(lib.smlDataSyncRegisterWriteDevInfCallback)
+    register_read_devinf_callback = instancemethod(lib.smlDataSyncRegisterReadDevInfCallback)
+    register_handle_remote_devinf_callback = instancemethod(lib.smlDataSyncRegisterHandleRemoteDevInfCallback)
+    register_change_status_callback = instancemethod(lib.smlDataSyncRegisterChangeStatusCallback)
+
+
+class Location(c_void_p):
+
+    new = staticmethod(lib.smlLocationNew)
+    get_uri = instancemethod(lib.smlLocationGetURI)
+    get_name = instancemethod(lib.smlLocationGetName)
+    set_name = instancemethod(lib.smlLocationSetName)
+
+
+class Error(c_void_p):
+
+    unref = lib.smlErrorDeref
+
+
+g_thread_init = lib.g_thread_init
+EventCallback = CFUNCTYPE(None, SyncObject, c_int, c_void_p, Error)
+GetAlertTypeCallback = CFUNCTYPE(c_int, SyncObject, c_char_p, c_int, c_void_p, POINTER(Error))
+ChangeCallback = CFUNCTYPE(c_int, SyncObject, c_char_p, c_int, c_char_p, c_char_p, c_uint, c_void_p, POINTER(Error))
+ChangeStatusCallback = CFUNCTYPE(c_int, SyncObject, c_uint, c_char_p, c_void_p, POINTER(Error))
+GetAnchorCallback = CFUNCTYPE(c_char_p, SyncObject, c_char_p, c_void_p, POINTER(Error))
+SetAnchorCallback = CFUNCTYPE(c_int, SyncObject, c_char_p, c_char_p, c_void_p, POINTER(Error))
+WriteDevInfCallback = CFUNCTYPE(c_int, SyncObject, Info, c_void_p, POINTER(Error))
+ReadDevInfCallback = CFUNCTYPE(Info, SyncObject, c_char_p, c_void_p, POINTER(Error))
+HandleRemoteDevInfCallback = CFUNCTYPE(c_int, SyncObject, Info, c_void_p, POINTER(Error))
+lib.smlDevInfDataStoreNew.argtypes = [c_char_p, POINTER(Error)]
+lib.smlDevInfDataStoreNew.restype = DataStore
+
+lib.smlDevInfDataStoreGetSourceRef.argtypes = []
+lib.smlDevInfDataStoreGetSourceRef.restype = c_char_p
+
+lib.smlDevInfDataStoreGetDisplayName.argtypes = []
+lib.smlDevInfDataStoreGetDisplayName.restype = c_char_p
+
+lib.smlDevInfGetMaxGUIDSize.argtypes = []
+lib.smlDevInfGetMaxGUIDSize.restype = c_char_p
+
+lib.smlDevInfNew.argtypes = [c_char_p, c_int, POINTER(Error)]
+lib.smlDevInfNew.restype = Info
+
+lib.smlDevInfAddDataStore.argtypes = [Info, DataStore]
+lib.smlDevInfAddDataStore.restype = None
+
+lib.smlDevInfNumDataStores.argtypes = [Info]
+lib.smlDevInfNumDataStores.restype = c_uint
+
+lib.smlDevInfGetNthDataStore.argtypes = [Info, c_uint]
+lib.smlDevInfGetNthDataStore.restype = DataStore
+
+lib.smlDevInfGetManufacturer.argtypes = []
+lib.smlDevInfGetManufacturer.restype = c_char_p
+
+lib.smlDevInfGetModel.argtypes = []
+lib.smlDevInfGetModel.restype = c_char_p
+
+lib.smlDevInfGetOEM.argtypes = []
+lib.smlDevInfGetOEM.restype = c_char_p
+
+lib.smlDevInfGetFirmwareVersion.argtypes = []
+lib.smlDevInfGetFirmwareVersion.restype = c_char_p
+
+lib.smlDevInfGetSoftwareVersion.argtypes = []
+lib.smlDevInfGetSoftwareVersion.restype = c_char_p
+
+lib.smlDevInfGetHardwareVersion.argtypes = []
+lib.smlDevInfGetHardwareVersion.restype = c_char_p
+
+lib.smlDevInfGetDeviceID.argtypes = []
+lib.smlDevInfGetDeviceID.restype = c_char_p
+
+lib.smlDevInfGetDeviceType.argtypes = []
+lib.smlDevInfGetDeviceType.restype = c_int
+
+lib.smlDevInfSupportsUTC.argtypes = []
+lib.smlDevInfSupportsUTC.restype = c_int
+
+lib.smlDevInfSupportsLargeObjs.argtypes = []
+lib.smlDevInfSupportsLargeObjs.restype = c_int
+
+lib.smlDevInfSupportsNumberOfChanges.argtypes = []
+lib.smlDevInfSupportsNumberOfChanges.restype = c_int
+
+lib.smlDataSyncObjectUnref.argtypes = [POINTER(SyncObject)]
+lib.smlDataSyncObjectUnref.restype = None
+
+lib.smlDataSyncNew.argtypes = [c_int, c_int, POINTER(Error)]
+lib.smlDataSyncNew.restype = SyncObject
+
+lib.smlDataSyncSetOption.argtypes = [SyncObject, c_char_p, c_char_p, POINTER(Error)]
+lib.smlDataSyncSetOption.restype = c_int
+
+lib.smlDataSyncAddDatastore.argtypes = [SyncObject, c_char_p, c_char_p, c_char_p, POINTER(Error)]
+lib.smlDataSyncAddDatastore.restype = c_int
+
+lib.smlDataSyncInit.argtypes = [SyncObject, POINTER(Error)]
+lib.smlDataSyncInit.restype = c_int
+
+lib.smlDataSyncRun.argtypes = [SyncObject, POINTER(Error)]
+lib.smlDataSyncRun.restype = c_int
+
+lib.smlDataSyncAddChange.argtypes = [SyncObject, c_char_p, c_int, c_char_p, c_char_p, c_uint, c_void_p, POINTER(Error)]
+lib.smlDataSyncAddChange.restype = c_int
+
+lib.smlDataSyncSendChanges.argtypes = [SyncObject, POINTER(Error)]
+lib.smlDataSyncSendChanges.restype = c_int
+
+lib.smlDataSyncAddMapping.argtypes = [SyncObject, c_char_p, c_char_p, c_char_p, POINTER(Error)]
+lib.smlDataSyncAddMapping.restype = c_int
+
+lib.smlDataSyncGetTarget.argtypes = [SyncObject, POINTER(Error)]
+lib.smlDataSyncGetTarget.restype = Location
+
+lib.smlDataSyncRegisterEventCallback.argtypes = [SyncObject, EventCallback]
+lib.smlDataSyncRegisterEventCallback.restype = None
+
+lib.smlDataSyncRegisterGetAlertTypeCallback.argtypes = [SyncObject, GetAlertTypeCallback]
+lib.smlDataSyncRegisterGetAlertTypeCallback.restype = None
+
+lib.smlDataSyncRegisterChangeCallback.argtypes = [SyncObject, ChangeCallback]
+lib.smlDataSyncRegisterChangeCallback.restype = None
+
+lib.smlDataSyncRegisterGetAnchorCallback.argtypes = [SyncObject, GetAnchorCallback]
+lib.smlDataSyncRegisterGetAnchorCallback.restype = None
+
+lib.smlDataSyncRegisterSetAnchorCallback.argtypes = [SyncObject, SetAnchorCallback]
+lib.smlDataSyncRegisterSetAnchorCallback.restype = None
+
+lib.smlDataSyncRegisterWriteDevInfCallback.argtypes = [SyncObject, WriteDevInfCallback]
+lib.smlDataSyncRegisterWriteDevInfCallback.restype = None
+
+lib.smlDataSyncRegisterReadDevInfCallback.argtypes = [SyncObject, ReadDevInfCallback]
+lib.smlDataSyncRegisterReadDevInfCallback.restype = None
+
+lib.smlDataSyncRegisterHandleRemoteDevInfCallback.argtypes = [SyncObject, HandleRemoteDevInfCallback]
+lib.smlDataSyncRegisterHandleRemoteDevInfCallback.restype = None
+
+lib.smlDataSyncRegisterChangeStatusCallback.argtypes = [SyncObject, ChangeStatusCallback]
+lib.smlDataSyncRegisterChangeStatusCallback.restype = None
+
+lib.smlLocationNew.argtypes = [c_char_p, c_char_p, POINTER(Error)]
+lib.smlLocationNew.restype = Location
+
+lib.smlLocationGetURI.argtypes = [Location]
+lib.smlLocationGetURI.restype = c_char_p
+
+lib.smlLocationGetName.argtypes = [Location]
+lib.smlLocationGetName.restype = c_char_p
+
+lib.smlLocationSetName.argtypes = [Location, c_char_p]
+lib.smlLocationSetName.restype = None
+
+lib.smlErrorDeref.argtypes = [POINTER(Error)]
+lib.smlErrorDeref.restype = None
+
+lib.g_thread_init.argtypes = [c_void_p]
+lib.g_thread_init.restype = None
+



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]