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

00001 /*
00002  * Copyright (C) 2003-2007 Funambol
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 as published by
00006  * the Free Software Foundation; either version 2 of the License, or
00007  * (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  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 Apr 27 12:29:19 2007 for Funambol C++ Client Library by  doxygen 1.5.2