//
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+/**
+ * @file
+ *
+ * This file provides APIs of Notification Service for common functions.
+ */
+
#ifndef _NS_COMMON_H_
#define _NS_COMMON_H_
-#define NS_ATTRIBUTE_POLICY "ACCEPTER"
-#define NS_ATTRIBUTE_MESSAGE "MESSAGE_URI"
-#define NS_ATTRIBUTE_SYNC "SYNC_URI"
-#define NS_ATTRIBUTE_ACCPETANCE "ACCEPTANCE"
-#define NS_ATTRIBUTE_ID "ID"
-#define NS_ATTRIBUTE_TITLE "TITLE"
-#define NS_ATTRIBUTE_TEXT "CONTENTTEXT"
-#define NS_ATTRIBUTE_STATE "STATE"
-#define NS_ATTRIBUTE_DEVICE "DEVICE"
+#include <stdint.h>
+#include <octypes.h>
+#define NS_UUID_STRING_SIZE 37
+//#define WITH_MQ
+/**
+ * Result code of notification service
+ */
typedef enum eResult
{
NS_OK = 100,
NS_ERROR = 200,
NS_SUCCESS = 300,
NS_FAIL = 400,
- NS_ALLOW = 500,
- NS_DENY = 600,
} NSResult;
-typedef enum eAccessPolicy
+/**
+ * Provider state of notification consumer service
+ */
+typedef enum
+{
+ NS_ALLOW = 1,
+ NS_DENY = 2,
+ NS_TOPIC = 3,
+ NS_DISCOVERED = 11,
+ NS_STOPPED = 12
+} NSProviderState;
+
+/**
+ * Notification message status to synchronize
+ */
+typedef enum
+{
+ NS_SYNC_UNREAD = 0,
+ NS_SYNC_READ = 1,
+ NS_SYNC_DELETED = 2,
+
+} NSSyncType;
+
+/**
+ * Notification Message Type
+ * Alert mean is High / critical
+ * Notice mean is low / critical
+ * Event mean is High / Normal
+ * Information mean is Low / Normal
+ */
+typedef enum
{
- NS_ACCEPTER_PROVIDER = 0,
- NS_ACCEPTER_CONSUMER = 1,
+ NS_MESSAGE_ALERT = 1,
+ NS_MESSAGE_NOTICE = 2,
+ NS_MESSAGE_EVENT = 3,
+ NS_MESSAGE_INFO = 4,
+ NS_MESSAGE_WARNING = 5,
+ NS_MESSAGE_READ = 11,
+ NS_MESSAGE_DELETED = 12
+
+} NSMessageType;
+
+/**
+ * Notification topic state
+ */
+typedef enum
+{
+ NS_TOPIC_UNSUBSCRIBED = 0,
+ NS_TOPIC_SUBSCRIBED = 1,
-} NSAccessPolicy;
+} NSTopicState;
-typedef struct
+/**
+ * Topic linked list
+ */
+typedef struct _nsTopic
{
- char * mId;
- void * mUserData;
-} NSDevice;
+ char * topicName;
+ NSTopicState state;
+ struct _nsTopic * next;
-typedef NSDevice NSConsumer;
+} NSTopicLL;
+/**
+ * Consumer information
+ */
typedef struct
{
- char * mId;
- char * mUserData;
- char * messageUri;
- char * syncUri;
-} NSProvider;
+ char consumerId[NS_UUID_STRING_SIZE];
+
+} NSConsumer;
+/**
+ * Provider information
+ */
typedef struct
{
- // Mandatory
- char * mId;
- char * mTitle;
+ char providerId[NS_UUID_STRING_SIZE];
- //Optional
- char * mContentText;
-
-} NSMessage;
+} NSProvider;
-typedef enum
+/**
+ * Media Contents of Notification Message (Optional)
+ */
+typedef struct
{
- Notification_Read,
- Notification_Dismiss,
-} NSSyncTypes;
+ char * iconImage;
+} NSMediaContents;
+
+/**
+ * Notification Message
+ */
typedef struct
{
- // Mandatory
- char * mMessageId;
- NSSyncTypes mState;
-
- //Optional
- NSDevice * mDevice;
+ //Mandatory
+ uint64_t messageId;
+ char providerId[NS_UUID_STRING_SIZE];
+
+ //optional
+ NSMessageType type;
+ char * dateTime;
+ uint64_t ttl;
+ char * title;
+ char * contentText;
+ char * sourceName;
+ NSMediaContents * mediaContents;
+ char * topic;
+ OCRepPayload * extraInfo;
-} NSSync;
+} NSMessage;
-typedef void (* NSSubscribeRequestCallback)(NSConsumer *);
-typedef void (* NSSyncCallback)(NSProvider *, NSSync *);
+/**
+ * Synchronization information of the notification message
+ */
+typedef struct
+{
+ uint64_t messageId;
+ char providerId[NS_UUID_STRING_SIZE];
+ NSSyncType state;
-typedef void (* NSProviderDiscoveredCallback)(NSProvider *);
-// NSMessage should deleted as user.
-typedef void (* NSNotificationReceivedCallback)(NSProvider *, NSMessage *);
+} NSSyncInfo;
#endif /* _NS_COMMON_H_ */