#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_SOURCE "SOURCE"
-#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
*/
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 = 0,
- Notification_Dismiss = 1,
- Notification_Unread = 2,
+ NS_SYNC_UNREAD = 0,
+ NS_SYNC_READ = 1,
+ NS_SYNC_DELETED = 2,
-} NSSyncTypes;
+} 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
{
- char * mId;
- void * mUserData;
+ 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
-} NSDevice;
+} NSMessageType;
/**
- * Consumer information is same to device information
+ * Notification topic state
*/
-typedef NSDevice NSConsumer;
+typedef enum
+{
+ NS_TOPIC_UNSUBSCRIBED = 0,
+ NS_TOPIC_SUBSCRIBED = 1,
+
+} NSTopicState;
+
+/**
+ * Topic linked list
+ */
+typedef struct _nsTopic
+{
+ char * topicName;
+ NSTopicState state;
+ struct _nsTopic * next;
+
+} NSTopicLL;
+
+/**
+ * Consumer information
+ */
+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;
- char * mSource;
+ //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;
*/
typedef struct
{
- // Mandatory
- char * mMessageId;
- NSSyncTypes mState;
-
- //Optional
- NSDevice * mDevice;
+ uint64_t messageId;
+ char providerId[NS_UUID_STRING_SIZE];
+ NSSyncType state;
-} NSSync;
+} NSSyncInfo;
#endif /* _NS_COMMON_H_ */