Hi, Lukas

If the google sync is not the good one,  which sync server would be better?
If i set the plugin_module to "iPhone_dbplugin1" the client get a 20010
error code.why?
You told me that just modify the code in the sample_dbplugin1.mm.,like "
readItemAsKey". But I found out that, the functions would never been called
in the class of "SamplePluginDB1", even the class "SamplePluginDB1" never
init by the engine.

Thanks
Regards
-Zhoulei

2012/3/23 <[email protected]>

> Send os-libsynthesis mailing list submissions to
>        [email protected]
>
> To subscribe or unsubscribe via the World Wide Web, visit
>        http://lists.synthesis.ch/mailman/listinfo/os-libsynthesis
> or, via email, send a message with subject or body 'help' to
>        [email protected]
>
> You can reach the person managing the list at
>        [email protected]
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of os-libsynthesis digest..."
>
>
> Today's Topics:
>
>   1. Re: what's deference between dbplugin for cocoa   and for cpp
>      (Lukas Zeller)
>   2. Re: os-libsynthesis Digest, Vol 33, Issue 6 (Lukas Zeller)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Thu, 22 Mar 2012 16:09:12 +0100
> From: Lukas Zeller <[email protected]>
> Subject: Re: [os-libsynthesis] what's deference between dbplugin for
>        cocoa   and for cpp
> To: zhou lei <[email protected]>
> Cc: [email protected]
> Message-ID: <[email protected]>
> Content-Type: text/plain; charset=iso-8859-1
>
> Hi Zhoulei,
>
> On Mar 20, 2012, at 10:31 , zhou lei wrote:
>
> > We can find "snowwhite" in the doc of the libsynthesis, and in the file
> named "dbapi.cpp" we can find it too.
>
> This is the C++ branch of things, it is not relevant for iOS (except maybe
> for general understanding of how the library works on other platforms).
>
> > And from the demo for IOS, We can find out that, in cocoa, the lib would
> using the code in "dbplugin_cocoa.m".
>
> dbplugin_cocoa.m is the wrapper code that handles the somewhat tricky
> interface between C and ObjC for you. No need to edit this.
>
> The actual plugin code to write will go into sample_dbplugin1.mm(2,3,4...).
>
> All you need to do is implementing the following methods:
>
> - (TSyError)startDataReadWithLastToken:(cAppCharP)aLastToken
> andResumeToken:(cAppCharP)aResumeToken;
>
> - (TSyError)readNextItemAsKey:(SettingsKey *)aItemKey
>  itemIdP:(NSString **)aItemIdP parentIdP:(NSString **)aParentIdP
>  statusP:(sInt32 *)aStatusP
>  isFirst:(BOOL)aFirst;
>
> - (TSyError)readItemAsKey:(SettingsKey *)aItemKey
>  itemID:(NSString *)aItemID parentID:(NSString *)aParentID;
>
> - (TSyError)endDataRead;
>
> - (TSyError)startDataWrite;
>
> - (TSyError)insertItemAsKey:(SettingsKey *)aItemKey
>  parentID:(NSString *)aParentID newItemIdP:(NSString **)aNewItemIdP;
>
> - (TSyError)updateItemAsKey:(SettingsKey *)aItemKey
>  itemIdP:(NSString **)aItemIdP parentIdP:(NSString **)aParentIdP;
>
> - (TSyError)deleteItem:(NSString *)aItemID parentID:(NSString *)aParentID;
>
> - (TSyError)endDataWriteWithSuccess:(BOOL)aSuccess andNewToken:(NSString
> **)aNewTokenP;
>
> ...plus maybe some of the optional methods if you have advanced features
> like filtering (but probably not to start with).
>
> These are semantically 1:1 representations in ObjC of the functions you
> find described in more detail in doc/SDK_manual.pdf and also in the C++
> samples. Because of the work the wrapper code does for you, it is only a
> small subset of what the C plugin ABI consists of. Things like module/db
> context creation/deletion is done in the wrapper.
>
> One important note: the Cocoa wrapper code only uses the "AsKey" variants
> from the plugin API. This means that rather than passing items as text
> strings, a SettingsKey object is passed, on which you can call methods like
> stringValueByName: / setStringValueByName:toValue: to access individual
> fields (see SettingsKey.h for all available access methods). Note that this
> is the same mechanism as for accessing settings, and you'll find examples
> for SettingsKey usage in the sample iOS app.
>
> Best Regards,
>
> Lukas Zeller, plan44.ch
> [email protected] - www.plan44.ch
>
>
>
>
> ------------------------------
>
> Message: 2
> Date: Thu, 22 Mar 2012 16:11:40 +0100
> From: Lukas Zeller <[email protected]>
> Subject: Re: [os-libsynthesis] os-libsynthesis Digest, Vol 33, Issue 6
> To: zhou lei <[email protected]>
> Cc: [email protected]
> Message-ID: <[email protected]>
> Content-Type: text/plain; charset=iso-8859-1
>
> Hi Zhoulei,
>
> On Mar 19, 2012, at 3:57 , zhou lei wrote:
>
> > In my satuation, I  want to sync the address book from the iphone to the
> sync server, and when needed the client would update the address book from
> the server. And for now, I just want to make the client works, and would
> using the syncML server of the google sync.
>
> Be careful and don't expect too much, Google contact sync is one of the
> less stellar SyncML implementations :-(
>
> > For the local address book, it may not been the iphone's but could be a
> db from sqlite.
>
> If you use SQLite, you don't need to write your own plugin. libsynthesis
> has built-in SQLite3 interface, all you need is creating a so-called
> mapping between the <fields> in the <fieldlist> and your actual database
> fields. This is done in the <fieldmap> section of the <datastore> in the
> XML config.
>
> Have a look at  /src/sysync_SDK/configs/sunbird_client.xml, this is a
> sample of an interface to a SQLite3 backend. The sample looks a bit
> complicated because of the large scripts handling all the special cases
> with exceptions etc., but for a plain contact database you probably will
> not need any scripts at all, so just a few lines of <map> definitions will
> do.
>
> > And when I set the dbplugin_module to "iPhone_plugin1" or
> "iPhone_plugin4", and try to sync, it will do nothing, off cause, there is
> not any usefull code in the "iPhone_plugin1", but the function there is
> just been call  ed when install the module. Must i using the session?
>
> All you need to do is filling actual DB access code into the methods in
> sample_dbplugin1.mm that have a comment with //%%% todo, starting with
> startDataReadWithLastToken.
>
> The wrapper code handles all the rest, instantiates the module and
> database contexts, and calls the methods you find in sample_dbplugin1.mm.
>
> Best Regards,
>
> Lukas Zeller, plan44.ch
> [email protected] - www.plan44.ch
>
>
>
>
> ------------------------------
>
> _______________________________________________
> os-libsynthesis mailing list
> [email protected]
> http://lists.synthesis.ch/mailman/listinfo/os-libsynthesis
>
>
> End of os-libsynthesis Digest, Vol 33, Issue 9
> **********************************************
>
_______________________________________________
os-libsynthesis mailing list
[email protected]
http://lists.synthesis.ch/mailman/listinfo/os-libsynthesis

Reply via email to