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 #ifndef INCL_FIRE_EVENTS 00020 #define INCL_FIRE_EVENTS 00021 00023 #include "event/BaseEvent.h" 00024 #include "event/SyncEvent.h" 00025 #include "event/SyncSourceEvent.h" 00026 #include "event/SyncItemEvent.h" 00027 #include "event/SyncStatusEvent.h" 00028 #include "event/TransportEvent.h" 00029 #include "event/constants.h" 00030 00031 /* 00032 * A set of global functions to fire an event from inside the API. 00033 */ 00034 00035 00036 /* 00037 * Fire a SyncEvent. 00038 * 00039 * @param msg : the message of sync event 00040 * @param type : the type of event to fire (see event/constants.h) 00041 * @return : TRUE if no errors, 00042 * FALSE if syncListener not instantiated, or 'type' wrong 00043 */ 00044 bool fireSyncEvent(const char* msg, int type); 00045 00046 /* 00047 * Fire a TransportEvent. 00048 * 00049 * @param size : the data size 00050 * @param type : the type of event to fire (see event/constants.h) 00051 * @return : TRUE if no errors, 00052 * FALSE if transportListener not instantiated, or 'type' wrong 00053 */ 00054 bool fireTransportEvent(unsigned long size, int type); 00055 00056 /* 00057 * Fire a SyncSourceEvent. 00058 * 00059 * @param sourceURI : the source being synchronized 00060 * @param sourceName: the source name being synchronized 00061 * @param mode : type of the performed sync 00062 * @param data : data information returned 00063 * @param type : the type of event to fire (see event/constants.h) 00064 * @return : TRUE if no errors, 00065 * FALSE if syncsourceListener not instantiated, or 'type' wrong 00066 */ 00067 bool fireSyncSourceEvent(const char* sourceURI, const char* sourceName, SyncMode mode, int data, int type); 00068 00069 /* 00070 * Fire a SyncItemEvent. 00071 * 00072 * @param sourceURI : the source the item belongs to 00073 * @param name : the source name 00074 * @param itemKey : the item key (GUID from the server) 00075 * @param type : the type of event to fire (see event/constants.h) 00076 * @return : TRUE if no errors, 00077 * FALSE if syncitemListener not instantiated, or 'type' wrong 00078 */ 00079 bool fireSyncItemEvent(const char* sourceURI, const char* name, const WCHAR* itemKey, int type); 00080 00081 /* 00082 * Fire a SyncStatusEvent. 00083 * 00084 * @param command : the command the status relates to 00085 * @param statusCode: the status code 00086 * @param name : the source name 00087 * @param uri : the source uri 00088 * @param itemKey : the key of the item this status relates to if it is in response of a modification command 00089 * @param type : the type of event to fire (see event/constants.h) 00090 * @return : TRUE if no errors, 00091 * FALSE if syncstatusListener not instantiated, or 'type' wrong 00092 */ 00093 bool fireSyncStatusEvent(const char* command, int statusCode, const char* name, const char* uri, const WCHAR* itemKey, int type); 00094 00095 00097 #endif