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 *****************************************************************************/ 00045 #ifndef __ALP_ATTNMGR_H__ 00046 #define __ALP_ATTNMGR_H__ 00047 00048 #include <time.h> 00049 #include <hiker/types.h> 00050 #include <hiker/sysclass.h> 00051 00052 #include <hiker/attnmgr_properties.h> 00053 00054 #ifdef __cplusplus 00055 extern "C" { 00056 #endif 00057 00121 #define ALP_ALERT_TYPE_ALP "/alp" 00122 00123 #define ALP_ALERT_TYPE_ALARM ALP_ALERT_TYPE_ALP "/alarm" 00124 00125 #define ALP_ALERT_TYPE_ALARM_CALENDAR ALP_ALERT_TYPE_ALARM "/calendar" 00126 00127 #define ALP_ALERT_TYPE_ALARM_ANNIVERSARY ALP_ALERT_TYPE_ALARM_CALENDAR "/anniversary" 00128 00129 #define ALP_ALERT_TYPE_ALARM_BIRTHDAY ALP_ALERT_TYPE_ALARM_CALENDAR "/birthday" 00130 00131 #define ALP_ALERT_TYPE_ALARM_CLOCK ALP_ALERT_TYPE_ALARM "/clock" 00132 00133 #define ALP_ALERT_TYPE_ALARM_TASK ALP_ALERT_TYPE_ALARM "/task" 00134 00135 #define ALP_ALERT_TYPE_ALARM_WAKEUP ALP_ALERT_TYPE_ALARM "/wakeup" 00136 00137 #define ALP_ALERT_TYPE_DOWNLOAD ALP_ALERT_TYPE_ALP "/download" 00138 00139 #define ALP_ALERT_TYPE_DOWNLOAD_STATUS ALP_ALERT_TYPE_DOWNLOAD "/status" 00140 00141 #define ALP_ALERT_TYPE_MESSAGING ALP_ALERT_TYPE_ALP "/messaging" 00142 00143 #define ALP_ALERT_TYPE_SECURITY ALP_ALERT_TYPE_ALP "/security" 00144 00145 /* end alert types */ 00147 00154 #ifndef ALP_ATTN_API_IMPL 00155 #define ALP_ATTN_API_IMPL 0 00156 #endif 00157 00158 #if ALP_ATTN_API_IMPL 00159 #define ALP_ATTN_DEPRECATE 00160 #else 00161 #define ALP_ATTN_DEPRECATE __attribute((deprecated)) 00162 #endif 00163 00168 #define ALP_STATUS_ATTN (ALP_CLASS_ATTN | 0x00010000) 00169 00170 #define ALP_STATUS_ATTN_BAD_PARAM (ALP_STATUS_ATTN | 0x00000100) 00171 00172 #define ALP_STATUS_ATTN_NO_MEMORY (ALP_STATUS_ATTN | 0x00000200) 00173 00174 #define ALP_STATUS_ATTN_INTERNAL_ERROR (ALP_STATUS_ATTN | 0x00000300) 00175 00176 #define ALP_STATUS_ATTN_NOT_FOUND (ALP_STATUS_ATTN | 0x00000400) 00177 00178 /* end errors */ 00179 00201 typedef enum { 00202 ALP_ATTN_PRIORITY_NONE = 0, 00203 ALP_ATTN_PRIORITY_EMERGENCY, 00204 ALP_ATTN_PRIORITY_CRITICAL, 00205 ALP_ATTN_PRIORITY_IMPORTANT, 00206 ALP_ATTN_PRIORITY_NOTICE, 00207 ALP_ATTN_PRIORITY_INFO, 00208 } AlpAttnPriority; 00209 00214 #define ALP_ATTN_PRIORITY_DEFAULT ALP_ATTN_PRIORITY_NONE 00215 00219 #define ALP_ATTN_PRIORITY_MAX ALP_ATTN_PRIORITY_CRITICAL 00220 00224 #define ALP_ATTN_PRIORITY_MIN ALP_ATTN_PRIORITY_LOW 00225 00229 #define ALP_ATTN_PRIORITY_HIGH ALP_ATTN_PRIORITY_IMPORTANT 00230 00234 #define ALP_ATTN_PRIORITY_MEDIUM ALP_ATTN_PRIORITY_NOTICE 00235 00239 #define ALP_ATTN_PRIORITY_LOW ALP_ATTN_PRIORITY_SOUND 00240 00244 #define ALP_ATTN_PRIORITY_LIST ALP_ATTN_PRIORITY_INFO 00245 00249 #define ALP_ATTN_PRIORITY_SOUND 0 00250 /* end priority level */ 00252 00257 #define ALP_ATTN_NOTIFY_FLAG_ACTION_MASK 0x000000FF //<! Mask for action field 00258 typedef enum { 00259 ALP_ATTN_NOTIFY_FLAG_ACTION_POST = 1, //<! Notify is for a post request 00260 ALP_ATTN_NOTIFY_FLAG_ACTION_UPDATE, //<! Notify is for an update request 00261 ALP_ATTN_NOTIFY_FLAG_ACTION_DELETE, //<! Notify is for a delete request 00262 ALP_ATTN_NOTIFY_FLAG_ACTION_PING //<! Notify is a simple ping (Ready test) 00263 } AlpAttnNotifyAction; 00264 00265 #define ALP_NOTIFY_EVENT_ATTN_ALERT "/alp/attn/alert/" 00266 typedef struct _AlpNotifyEventAttnAlert AlpNotifyEventAttnAlert; 00267 struct _AlpNotifyEventAttnAlert { 00268 uint32_t index; //<! Alert index 00269 uint32_t flags; //<! Flags associated with alert 00270 char handle[]; //<! Handle of alert associated with event 00271 }; 00272 00273 /* end alert notify event */ 00275 00306 typedef struct _AlpAttnProp AlpAttnProp; 00314 struct _AlpAttnProp { 00315 char *key; 00316 char *value; 00317 }; 00318 00324 #define ALP_ATTN_PROP(k,v) { .key = (k), .value = (v), } 00325 00334 #define ALP_ATTN_PROPERTY(SHORTKEY,v) { .key = (ALP_ATTN_PROP_##SHORTKEY), .value = (v), } 00335 /* end alert property */ 00337 00338 00432 alp_status_t alp_attn_post (const char *sourceAppId, 00433 const char *alertTypeName, 00434 const char *handle, 00435 uint32_t nprops, 00436 const AlpAttnProp properties[]); 00437 00458 typedef void (*AlpAttnPostCB)(const char *sourceAppId, 00459 const char *alertTypeName, 00460 const char *handle, 00461 int argc, 00462 char *argv[], 00463 void *user_data); 00566 alp_status_t alp_attn_post_with_callback (const char *sourceAppId, 00567 const char *alertTypeName, 00568 const char *handle, 00569 uint32_t nprops, 00570 const AlpAttnProp properties[], 00571 AlpAttnPostCB callback, 00572 void *user_data); 00573 00606 alp_status_t alp_attn_update (const char *sourceAppId, 00607 const char *alertTypeName, 00608 const char *handle, 00609 uint32_t nprops, 00610 const AlpAttnProp properties[]); 00611 00644 alp_status_t alp_attn_delete (const char *sourceAppId, 00645 const char *alertTypeName, 00646 const char *handle); 00647 00648 00654 alp_status_t alp_attn_alert_post (const char *sourceAppId, 00655 const char *alertTypeName, 00656 const char *handle, 00657 const char *interface, 00658 int32_t priority, 00659 int32_t duration, 00660 uint32_t nprops, 00661 const AlpAttnProp properties[]) ALP_ATTN_DEPRECATE; 00662 00668 typedef void (*AlpAttnAlertCB)(const char *sourceAppId, 00669 const char *alertTypeName, 00670 const char *handle, 00671 int argc, 00672 char *argv[], 00673 void *user_data) /* THIS TYPEDEF IS DEPRECATED - DO NOT USE */; 00680 alp_status_t alp_attn_alert_post_with_callback (const char *sourceAppId, 00681 const char *alertTypeName, 00682 const char *handle, 00683 const char *interface, 00684 int32_t priority, 00685 int32_t duration, 00686 uint32_t nprops, 00687 const AlpAttnProp properties[], 00688 AlpAttnAlertCB callback, 00689 void *user_data) ALP_ATTN_DEPRECATE; 00690 00696 alp_status_t alp_attn_alert_update (const char *sourceAppId, 00697 const char *alertTypeName, 00698 const char *handle, 00699 uint32_t nprops, 00700 const AlpAttnProp properties[]) ALP_ATTN_DEPRECATE; 00701 00707 alp_status_t alp_attn_alert_delete (const char *sourceAppId, 00708 const char *alertTypeName, 00709 const char *handle) ALP_ATTN_DEPRECATE; 00710 /* enggroup ALP_ATTENTION_API */ 00712 /* endgroup ALP_ATTENTION_MGR */ 00714 00715 #ifdef __cplusplus 00716 } 00717 #endif 00718 00719 #endif /* __ALP_ATTNMGR_H__ */
Copyright © 1999-2008 ACCESS CO., LTD. All rights reserved.