include/hiker/notifymgr.h

Go to the documentation of this file.
00001 /********************************************************************
00002  *
00003  * Copyright (c) 1999-2008 ACCESS CO., LTD. All rights reserved.
00004  * Copyright 2006, 2007, ACCESS Systems Americas, Inc. All rights reserved.
00005  *
00006  * Version: MPL 1.1/LGPL 2.1
00007  *
00008  * The contents of this file are subject to the Mozilla Public License Version
00009  * 1.1 (the "License"); you may not use this file except in compliance with
00010  * the License. You may obtain a copy of the License at
00011  * http://www.mozilla.org/MPL/
00012  *
00013  * Software distributed under the License is distributed on an "AS IS" basis,
00014  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00015  * for the specific language governing rights and limitations under the
00016  * License.
00017  *
00018  * The Original Code is hikerproject.org code.
00019  *
00020  * The Initial Developer of the Original Code is ACCESS Systems Americas, Inc.
00021  *               Portions created by the Initial Developer are
00022  *      Copyright 2006-2007 the Initial Developer. All Rights Reserved.
00023  *
00024  * Contributor(s):
00025  *
00026  * Alternatively, the contents of this file may be used under the terms of
00027  * the GNU Lesser General Public License Version 2.1 (the "LGPL"), in which
00028  * case the provisions of the LGPL are applicable instead of those above.
00029  * If you wish to allow use of your version of this file only under the terms
00030  * of the LGPL, and not to allow others to use your version of this file under
00031  * the terms of the MPL, indicate your decision by deleting the provisions
00032  * above and replace them with the notice and other provisions required by
00033  * the LGPL. If you do not delete the provisions above, a recipient may use
00034  * your version of this file under the terms of either the MPL or the LGPL. 
00035  * You may obtain a copy of the LGPL at http://www.gnu.org/licenses/lgpl.txt.
00036  *
00037  ********************************************************************/
00038 
00047 #ifndef NOTIFY_MGR_H
00048 #define NOTIFY_MGR_H
00049 
00050 
00051 #ifdef __cplusplus
00052 extern "C" {
00053 #endif
00054 
00055 #include <glib.h>
00056 #include <hiker/types.h>
00057 #include <hiker/sysclass.h>
00058 
00065 // -----------------------------------------------------------------------------
00066 // notification types
00067 // -----------------------------------------------------------------------------
00068 
00070 #define ALP_NOTIFY_EVENT_NOTIFY_REGISTER                "/alp/notify/register/"
00071 
00073 #define ALP_NOTIFY_EVENT_NOTIFY_INSTALL         "/alp/notify/install/"
00074 
00076 #define ALP_NOTIFY_EVENT_NOTIFY_BOOT            "/alp/notify/boot/"
00077         
00079 #define ALP_NOTIFY_EVENT_HOMESCREEN_ACTIVATE    "/alp/notify/homescreen_activate/"
00080 
00081 //
00082 // -----------------------------------------------------------------------------
00083 // maximum sizes
00084 // -----------------------------------------------------------------------------
00085 
00087 #define ALP_NOTIFY_MAX_NOTIFY_SIZE              128
00088 
00090 #define ALP_NOTIFY_MAX_DETAILS_SIZE             256
00091 
00093 #define ALP_NOTIFY_MAX_APPID_SIZE               64
00094 
00095 // -----------------------------------------------------------------------------
00096 // argv parameters when receiving a notification
00097 // -----------------------------------------------------------------------------
00098 
00100 #define ALP_NOTIFY_LAUNCH_DETAILS               "--alp-notify-details="
00101 
00103 #define ALP_NOTIFY_LAUNCH_TYPE                  "--alp-notify-type="
00104 
00105 // -----------------------------------------------------------------------------
00106 // register priority and flags
00107 // -----------------------------------------------------------------------------
00108 
00110 #define ALP_NOTIFY_PRIORITY_HIGH                10
00111 
00113 #define ALP_NOTIFY_PRIORITY_NORMAL              0
00114 
00116 #define ALP_NOTIFY_PRIORITY_LOW                 -10
00117 
00119 #define ALP_NOTIFY_REGISTER_FLAG_DONTSAVE       0x01
00120 
00122 #define ALP_NOTIFY_REGISTER_FLAG_ONETIME        0x02
00123 
00125 #define ALP_NOTIFY_REGISTER_FLAG_BGTHREAD       0x04
00126 
00127 // -----------------------------------------------------------------------------
00128 // broadcast queues and flags
00129 // -----------------------------------------------------------------------------
00130 
00132 #define ALP_NOTIFY_QUEUE_DEFAULT                0x01
00133 
00135 #define ALP_NOTIFY_QUEUE_STATUSGADGET           0x02
00136 
00138 #define ALP_NOTIFY_BROADCAST_FLAG_IMMEDIATE     0x01
00139 
00141 #define ALP_NOTIFY_BROADCAST_FLAG_SPECIAL       0x02
00142 
00143 // -----------------------------------------------------------------------------
00144 // callback return values
00145 // -----------------------------------------------------------------------------
00146 
00148 #define ALP_NOTIFY_CALLBACK_CONTINUE            0x00
00149 
00151 #define ALP_NOTIFY_CALLBACK_CANCEL              0x01
00152 
00154 #define ALP_NOTIFY_CALLBACK_COMPLETED_ALREADY   0x02
00155 
00156 // -----------------------------------------------------------------------------
00157 // error codes
00158 // -----------------------------------------------------------------------------
00159 
00161 #define ALP_NOTIFY_ERR_OUT_OF_MEMORY            (ALP_CLASS_NOTIFY | 0x00010000)
00162 
00164 #define ALP_NOTIFY_ERR_INVALID_CALLBACK         (ALP_CLASS_NOTIFY | 0x00020000)
00165 
00167 #define ALP_NOTIFY_ERR_INVALID_APPID            (ALP_CLASS_NOTIFY | 0x00030000)
00168 
00170 #define ALP_NOTIFY_ERR_INVALID_QUEUE            (ALP_CLASS_NOTIFY | 0x00040000)
00171 
00173 #define ALP_NOTIFY_ERR_INVALID_PRIORITY         (ALP_CLASS_NOTIFY | 0x00050000)
00174 
00176 #define ALP_NOTIFY_ERR_INVALID_NOTIFYTYPE       (ALP_CLASS_NOTIFY | 0x00060000)
00177 
00179 #define ALP_NOTIFY_ERR_INVALID_LENGTH           (ALP_CLASS_NOTIFY | 0x00070000)
00180 
00182 #define ALP_NOTIFY_ERR_INVALID_CMD              (ALP_CLASS_NOTIFY | 0x00080000)
00183 
00185 #define ALP_NOTIFY_ERR_NOT_REGISTERED           (ALP_CLASS_NOTIFY | 0x00090000)
00186 
00188 #define ALP_NOTIFY_ERR_ALREADY_REGISTERED       (ALP_CLASS_NOTIFY | 0x000a0000)
00189 
00191 #define ALP_NOTIFY_ERR_TOO_MANY_REGISTRATIONS   (ALP_CLASS_NOTIFY | 0x000b0000)
00192 
00194 #define ALP_NOTIFY_ERR_TOO_MANY_BROADCASTS      (ALP_CLASS_NOTIFY | 0x000c0000)
00195 
00197 #define ALP_NOTIFY_ERR_ACTIVE_BROADCAST         (ALP_CLASS_NOTIFY | 0x000d0000)
00198 
00200 #define ALP_NOTIFY_ERR_IPC                      (ALP_CLASS_NOTIFY | 0x000e0000)
00201 
00203 #define ALP_NOTIFY_ERR_INVALID_FLAG             (ALP_CLASS_NOTIFY | 0x000f0000)
00204 
00206 #define ALP_NOTIFY_ERR_PERMISSION_DENIED        (ALP_CLASS_NOTIFY | 0x00100000)
00207 
00208 // -----------------------------------------------------------------------------
00209 // data structures
00210 // -----------------------------------------------------------------------------
00211 
00214 typedef struct _AlpNotifyLaunch AlpNotifyLaunch;
00215 struct _AlpNotifyLaunch {
00216         int handled;
00217         int length;
00218         char details[ALP_NOTIFY_MAX_DETAILS_SIZE+1];
00219         char notifyType[ALP_NOTIFY_MAX_NOTIFY_SIZE+1];
00220         char appID[ALP_NOTIFY_MAX_APPID_SIZE+1];
00221 };
00222 
00225 typedef struct _AlpNotifyGroupArgs AlpNotifyGroupArgs;
00226 struct _AlpNotifyGroupArgs 
00227 {
00228     GList *notifications;
00229 } ;
00230 
00231 // -----------------------------------------------------------------------------
00232 // functions
00233 // -----------------------------------------------------------------------------
00234 
00246 typedef int (AlpNotifyCallbackProc)(const char * notifyType, void * details, int length, int * handled, const char * appID, void * userData);
00247 
00252 typedef void (AlpNotifyCompletionProc)(void * userData, int handled);
00253 
00272 extern alp_status_t alp_notify_register(const char * notifyType, AlpNotifyCallbackProc * callbackProc, void *userData, int priority, int flags);
00273 
00291 extern alp_status_t alp_notify_register_launch(const char * appID, const char * notifyType, int priority, int flags);
00292 
00306 extern alp_status_t alp_notify_unregister_launch(const char * appID, const char * notifyType, int flags);
00307 
00319 extern alp_status_t alp_notify_unregister(const char * notifyType, int flags);
00320 
00340 extern alp_status_t alp_notify_broadcast(const char * appID, const char * notifyType, const void * details, int length, int queue, int flags);
00341 
00353 extern void alp_notify_group_broadcast_add(AlpNotifyGroupArgs *group, const char * appID, const char * notifyType, const void * details, int length, int queue, int flags);
00354 
00357 extern AlpNotifyGroupArgs * alp_notify_group_new(void);
00358 
00362 extern void alp_notify_group_clean(AlpNotifyGroupArgs *group);
00363 
00367 extern void alp_notify_group_free(AlpNotifyGroupArgs *group);
00368 
00383 extern alp_status_t alp_notify_group_send(AlpNotifyGroupArgs * group);
00384 
00406 extern alp_status_t alp_notify_broadcast_full(const char * appID, const char * notifyType, const void * details, int length, int queue, int flags, AlpNotifyCompletionProc * completionProc, void * userData);
00407 
00428 extern alp_status_t alp_notify_broadcast_sync(const char * appID, const char * notifyType, const void * details, int length, int queue, int flags, int * handled);
00429 
00442 extern alp_status_t alp_notify_done(const char * appID, int handled, int status);
00443 
00450 extern int alp_notify_details(const char * src, AlpNotifyLaunch * dst);
00451 
00453 
00454 #ifdef __cplusplus
00455 }       // extern "C"
00456 #endif
00457 
00458 #endif

Generated on Wed Jul 30 07:06:39 2008 by Doxygen 1.4.6 for ALP SDK + Hiker Documentation

Copyright © 1999-2008 ACCESS CO., LTD. All rights reserved.