Initializing the Reference Implementation

Team-Fly    

SyncML®: Synchronizing and Managing Your Mobile Data
By Uwe Hansmann, Riku Mettälä, Apratim Purakayastha, Peter Thompson, Phillipe Kahn
Table of Contents
Chapter 10.  SyncML API and Reference Implementation


Before using the toolkit to generate or parse any documents, it has to be initialized using the smlInit function. Likewise smlTerminate needs to be called before the application is terminated to allow the toolkit to free all resources allocated during initialization.

 SyncMLOptions_t    syncmlOptions; // Define the maximum amount of memory that // the workspace should use syncmlOptions->maxWorkspaceAvailMem = 60000; syncmlOptions->defaultPrintFunc = NULL; //Initialize SyncML smlInit(syncmlOptions); // Data processing takes place here ... // Cleanup all allocated resources smlTerminate(); 

The above example shows how the toolkit is initialized to a maximum memory buffer of 60,000 bytes usable by the toolkit. If the toolkit should generate tracing or logging information, then the defaultPrintFunc needs to point to a callback function allowing storage or display of this information. In this case it is set to NULL to indicate to the toolkit that no tracing information is required.

The examples in the following subsections focus on illustrating how the toolkit should be used. For the sake of readability, these examples make a number of simplifications, which should not be made in production code. For instance, the examples do not check all the return codes from the called functions.


    Team-Fly    
    Top
     



    SyncML. Synchronizing and Managing Your Mobile Data
    SyncML: Synchronizing and Managing Your Mobile Data
    ISBN: 0130093696
    EAN: 2147483647
    Year: 2001
    Pages: 124

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net