src/include/common/syncml/core/SyncNotification.h

00001 /*
00002  * Copyright (C) 2003-2007 Funambol, Inc
00003  *
00004  * This program is free software; you can redistribute it and/or modify
00005  * it under the terms of the GNU General Public License version 2 as
00006  * published by the Free Software Foundation.
00007  *
00008  * This program is distributed in the hope that it will be useful,
00009  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00010  * MERCHANTABILITY, TITLE, NONINFRINGEMENT or FITNESS FOR A PARTICULAR
00011  * PURPOSE.  See the GNU General Public License for more details.
00012  *
00013  * You should have received a copy of the GNU General Public License
00014  * along with this program; if not, write to the Free Software
00015  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00016  * 02111-1307  USA
00017  */
00018 
00019 /*
00020  * This class represent a Server Alerted Notification for DS message (Pkg0).
00021  * After a call to method parse(), the object contains the message data in
00022  * a usable form.
00023  */
00024 
00025 #ifndef INCL_NOTIF_PROCESSOR
00026 #define INCL_NOTIF_PROCESSOR
00027 
00029 #include "syncml/core/SyncAlert.h"
00030 
00031 // Define User Interaction Modes
00032 enum SN_UIMode {
00033     UI_NotSpecified,
00034     UI_Background,
00035     UI_Info,
00036     UI_Interactive
00037 };
00038 
00039 // Define Sync Initiator
00040 enum SN_Initiator {
00041     UserInitiated,
00042     ServerInitiated
00043 };
00044 
00045 // Sync Notification Error Codes
00046 enum SN_Errors {
00047     SNErr_Ok,
00048     SNErr_BadReq,
00049     SNErr_InvSync,
00050     SNErr_Incomplete,
00051     SNErr_NullValue,
00052     SNErr_Undefined = 255         // Generic error
00053 };
00054 
00055 
00056 class SyncNotification {
00057 
00058     public:
00059 
00060         // Constructor
00061         SyncNotification();
00062         // Destructor
00063         ~SyncNotification();
00064 
00065         /*
00066          * Parse a PKG0 message
00067          */
00068         SN_Errors parse(const char *msg, int len);
00069 
00070         /*
00071          * Accessor methods
00072          */
00073         int getVersion();
00074         SN_UIMode getUIMode();
00075         SN_Initiator getInitiator();
00076         int getSessionId();
00077         const char*  getServerId();
00078         int getNumSyncs();
00079         SyncAlert* getSyncAlert ( int idx );
00080 
00081     private:
00082         // Notification Header
00083         int version;
00084         SN_UIMode uiMode;
00085         SN_Initiator initiator;
00086         int sessionId;
00087         char*  serverId;
00088         // Notification Body
00089         int numSyncs;
00090         SyncAlert *syncAlerts;
00091 
00092         void reset(bool free);
00093 };
00094 
00096 #endif
00097 

Generated on Fri Nov 9 12:21:26 2007 for Funambol Outlook Plug-in Library by  doxygen 1.5.2