replace : iotivity -> iotivity-sec
[platform/upstream/iotivity.git] / service / notification / include / NSCommon.h
index 3d299be..35200df 100644 (file)
 #ifndef _NS_COMMON_H_
 #define _NS_COMMON_H_
 
-#include <ocstack.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
  */
@@ -48,65 +41,119 @@ typedef enum eResult
     NS_ERROR = 200,
     NS_SUCCESS = 300,
     NS_FAIL = 400,
-    NS_ALLOW = 500,
-    NS_DENY = 600,
 
 } NSResult;
 
 /**
- * Access policy exchanged between provider and consumer during subscription process
+ * Provider state of notification consumer service
  */
-typedef enum eAccessPolicy
+typedef enum
 {
-    NS_ACCEPTER_PROVIDER = 0,
-    NS_ACCEPTER_CONSUMER = 1,
-
-} NSAccessPolicy;
+    NS_ALLOW = 1,
+    NS_DENY = 2,
+    NS_TOPIC = 3,
+    NS_DISCOVERED = 11,
+    NS_STOPPED = 12
+} NSProviderState;
 
 /**
  * Notification message status to synchronize
  */
 typedef enum
 {
-    Notification_Read,
-    Notification_Dismiss,
-} NSSyncTypes;
+    NS_SYNC_UNREAD = 0,
+    NS_SYNC_READ = 1,
+    NS_SYNC_DELETED = 2,
+
+} NSSyncType;
 
 /**
- *  Device information
+ * Notification Message Type
+ * Alert mean is High / critical
+ * Notice mean is low / critical
+ * Event mean is High / Normal
+ * Information mean is Low / Normal
  */
-typedef struct
+typedef enum
+{
+    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,
+
+} NSTopicState;
+
+/**
+ * Topic linked list
+ */
+typedef struct _nsTopic
 {
-    char * mId;
-    void * mUserData;
-} NSDevice;
+    char * topicName;
+    NSTopicState state;
+    struct _nsTopic * next;
+
+} NSTopicLL;
 
 /**
- *  Consumer information is same to device information
+ *  Consumer information
  */
-typedef NSDevice NSConsumer;
+typedef struct
+{
+    char consumerId[NS_UUID_STRING_SIZE];
+
+} NSConsumer;
 
 /**
  *  Provider information
  */
 typedef struct
 {
-    char * mId;
-    char * mUserData;
-    char * messageUri;
-    char * syncUri;
-    OCDoHandle messageHandle;
-    OCDoHandle syncHandle;
+    char providerId[NS_UUID_STRING_SIZE];
+
 } NSProvider;
 
 /**
+ *  Media Contents of Notification Message (Optional)
+ */
+typedef struct
+{
+    char * iconImage;
+
+} NSMediaContents;
+
+/**
  *  Notification Message
  */
 typedef struct
 {
-    char * mId;
-    char * mTitle;
-    char * mContentText;
+    //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;
+
 } NSMessage;
 
 /**
@@ -114,13 +161,11 @@ typedef struct
  */
 typedef struct
 {
-    // Mandatory
-    char * mMessageId;
-    NSSyncTypes mState;
+    uint64_t messageId;
+    char providerId[NS_UUID_STRING_SIZE];
+    NSSyncType state;
 
-    //Optional
-    NSDevice * mDevice;
-} NSSync;
+} NSSyncInfo;
 
 #endif /* _NS_COMMON_H_ */