notification_consumer_src = [
env.Glob('src/consumer/*.c'), env.Glob('src/common/*.c')]
-#providersdk = notification_env.SharedLibrary('notification_provider', notification_provider_src)
-#notification_env.InstallTarget(providersdk, 'libnotification_provider')
-#notification_env.UserInstallTargetLib(providersdk, 'libnotification_provider')
+providersdk = notification_env.SharedLibrary('notification_provider', notification_provider_src)
+notification_env.InstallTarget(providersdk, 'libnotification_provider')
+notification_env.UserInstallTargetLib(providersdk, 'libnotification_provider')
consumersdk = notification_env.SharedLibrary('notification_consumer', notification_consumer_src)
notification_env.InstallTarget(consumersdk, 'libnotification_consumer')
notification_env.UserInstallTargetLib(consumersdk, 'libnotification_consumer')
-#providersdk = notification_env.StaticLibrary('notification_provider', notification_provider_src)
-#notification_env.InstallTarget(providersdk, 'libnotification_provider')
-#notification_env.UserInstallTargetLib(providersdk, 'libnotification_provider')
+providersdk = notification_env.StaticLibrary('notification_provider', notification_provider_src)
+notification_env.InstallTarget(providersdk, 'libnotification_provider')
+notification_env.UserInstallTargetLib(providersdk, 'libnotification_provider')
consumersdk = notification_env.StaticLibrary('notification_consumer', notification_consumer_src)
notification_env.InstallTarget(consumersdk, 'libnotification_consumer')
notification_env.UserInstallTargetLib(consumersdk, 'libnotification_consumer')
-#notification_env.UserInstallTargetHeader('include/NSProviderInterface.h',\
-# 'service/notification', 'NSProviderInterface.h')
+notification_env.UserInstallTargetHeader('include/NSProviderInterface.h',\
+ 'service/notification', 'NSProviderInterface.h')
notification_env.UserInstallTargetHeader('include/NSConsumerInterface.h',\
'service/notification', 'NSConsumerInterface.h')
# SConscript('unittest/SConscript')
# Go to build sample apps
-#SConscript('examples/SConscript')
+SConscript('examples/SConscript')
# Go to build jni
#if target_os == 'android':
// Input the following values to publish resource to cloud\r
char REMOTE_SERVER_ADDRESS[50];\r
char REMOTE_SERVER_SESSION[50];\r
-char mainConsumer[37] = '\0';\r
+char mainConsumer[37] = {'\0',};\r
\r
extern char *strdup(const char *s);\r
\r
return fopen("oic_ns_provider_db.dat", mode);\r
}\r
\r
-void printTopics(NSTopics * topics)\r
+void printTopics(NSTopicLL * topics)\r
{\r
if(!topics)\r
{\r
return;\r
}\r
\r
- NSTopics * iter = topics;\r
+ NSTopicLL * iter = topics;\r
\r
while(iter)\r
{\r
}\r
}\r
\r
-void removeTopics(NSTopics * topics)\r
+void removeTopics(NSTopicLL * topics)\r
{\r
if(!topics)\r
{\r
return;\r
}\r
\r
- NSTopics * iter = topics;\r
+ NSTopicLL * iter = topics;\r
\r
while(iter)\r
{\r
- NSTopics * del = iter;\r
+ NSTopicLL * del = iter;\r
if(del->topicName)\r
{\r
OICFree(del->topicName);\r
\r
case 7:\r
printf("NSProviderSelectTopic\n");\r
- NSProviderSelectTopic("OCF_TOPIC1");\r
- NSProviderSelectTopic("OCF_TOPIC2");\r
- NSProviderSelectTopic("OCF_TOPIC3");\r
- NSProviderSelectTopic("OCF_TOPIC4");\r
+ NSProviderSelectTopic(mainConsumer, "OCF_TOPIC1");\r
+ NSProviderSelectTopic(mainConsumer, "OCF_TOPIC2");\r
+ NSProviderSelectTopic(mainConsumer, "OCF_TOPIC3");\r
+ NSProviderSelectTopic(mainConsumer, "OCF_TOPIC4");\r
break;\r
\r
case 8:\r
printf("NSProviderUnSelectTopic\n");\r
- NSProviderUnSelectTopic("OCF_TOPIC1");\r
+ NSProviderUnselectTopic(mainConsumer, "OCF_TOPIC1");\r
break;\r
\r
case 9:\r
printf("NSProviderGetConsumerTopics\n");\r
- NSTopics * topics = NSProviderGetConsumerTopics(mainConsumer);\r
- printTopics(topics);\r
- removeTopics(topics);\r
+ {\r
+ NSTopicLL * topics = NSProviderGetConsumerTopics(mainConsumer);\r
+ printTopics(topics);\r
+ removeTopics(topics);\r
+ }\r
break;\r
\r
case 10:\r
printf("NSProviderGetConsumerTopics\n");\r
- NSTopics * topics = NSProviderGetTopics();\r
- printTopics(topics);\r
- removeTopics(topics);\r
+ {\r
+ NSTopicLL * topics = NSProviderGetTopics();\r
+ printTopics(topics);\r
+ removeTopics(topics);\r
+ }\r
break;\r
\r
case 11:\r
return msg;\r
}\r
\r
-NSTopics * NSProviderGetConsumerTopics(char *consumerId)\r
+NSTopicLL * NSProviderGetConsumerTopics(char *consumerId)\r
{\r
NS_LOG(DEBUG, "NSProviderGetConsumerTopics - IN");\r
pthread_mutex_lock(&nsInitMutex);\r
return NS_FAIL;\r
}\r
\r
- NSTopics * topics = NSProviderGetConsumerTopicsCacheData(consumerTopicList, consumerId);\r
+ NSTopicLL * topics = NSProviderGetConsumerTopicsCacheData(consumerTopicList, consumerId);\r
\r
pthread_mutex_unlock(&nsInitMutex);\r
return topics;\r
}\r
\r
-NSTopics * NSProviderGetTopics()\r
+NSTopicLL * NSProviderGetTopics()\r
{\r
NS_LOG(DEBUG, "NSProviderGetTopics - IN");\r
pthread_mutex_lock(&nsInitMutex);\r
\r
- NSTopics * topics = NSProviderGetTopicsCacheData(registeredTopicList);\r
+ NSTopicLL * topics = NSProviderGetTopicsCacheData(registeredTopicList);\r
\r
pthread_mutex_unlock(&nsInitMutex);\r
NS_LOG(DEBUG, "NSProviderGetTopics - OUT");\r
return NS_FAIL;\r
}\r
\r
-NSTopics * NSProviderGetTopicsCacheData(NSCacheList * regTopicList)\r
+NSTopicLL * NSProviderGetTopicsCacheData(NSCacheList * regTopicList)\r
{\r
NS_LOG(DEBUG, "NSProviderGetTopicsCache - IN");\r
pthread_mutex_lock(&NSCacheMutex);\r
return NULL;\r
}\r
\r
- NSTopics * iterTopic = NULL;\r
- NSTopics * newTopic = NULL;\r
- NSTopics * topics = NULL;\r
+ NSTopicLL * iterTopic = NULL;\r
+ NSTopicLL * newTopic = NULL;\r
+ NSTopicLL * topics = NULL;\r
\r
while (iter)\r
{\r
NSCacheTopicData * curr = (NSCacheTopicData *) iter->data;\r
\r
- newTopic = (NSTopics *) OICMalloc(sizeof(NSTopics));\r
+ newTopic = (NSTopicLL *) OICMalloc(sizeof(NSTopicLL));\r
newTopic->state = curr->state;\r
newTopic->next = NULL;\r
newTopic->topicName = OICStrdup(curr->topicName);\r
return topics;\r
}\r
\r
-NSTopics * NSProviderGetConsumerTopicsCacheData(NSCacheList * conTopicList, char *consumerId)\r
+NSTopicLL * NSProviderGetConsumerTopicsCacheData(NSCacheList * conTopicList, char *consumerId)\r
{\r
NS_LOG(DEBUG, "NSProviderGetConsumerTopics - IN");\r
\r
pthread_mutex_lock(&NSCacheMutex);\r
- NSTopics * topics = NSProviderGetTopics();\r
+ NSTopicLL * topics = NSProviderGetTopics();\r
\r
if(!topics)\r
{\r
\r
if(curr && strcmp(curr->id, consumerId) == 0)\r
{\r
- NSTopics * topicIter = topics;\r
+ NSTopicLL * topicIter = topics;\r
while(topicIter)\r
{\r
if(strcmp(topicIter->topicName, curr->topicName) == 0)\r
\r
NSResult NSProviderDeleteSubDataFromObId(NSCacheList * list, OCObservationId id);\r
\r
-NSTopics * NSProviderGetTopicsCacheData(NSCacheList * regTopicList);\r
+NSTopicLL * NSProviderGetTopicsCacheData(NSCacheList * regTopicList);\r
\r
-NSTopics * NSProviderGetConsumerTopicsCacheData(NSCacheList * conTopicList, char *consumerId);\r
+NSTopicLL * NSProviderGetConsumerTopicsCacheData(NSCacheList * conTopicList, char *consumerId);\r
\r
size_t NSProviderGetListSize(NSCacheElement * firstElement);\r
\r
NS_LOG(DEBUG, "NSSendTopicList - IN");\r
\r
char * id = NSGetValueFromQuery(OICStrdup(entityHandlerRequest->query), NS_QUERY_CONSUMER_ID);\r
- NSTopics * topics = NULL;\r
+ NSTopicLL * topics = NULL;\r
NSCacheElement * currList = NULL;\r
\r
if(!id)\r
size_t dimensions[3] = {dimensionSize, 0, 0};\r
for (int i = 0; i < (int)dimensionSize; i++)\r
{\r
- NSTopics * topic = (NSTopics *) iter->data;\r
+ NSTopicLL * topic = (NSTopicLL *) iter->data;\r
\r
payloadTopicArray[i] = OCRepPayloadCreate();\r
OCRepPayloadSetPropString(payloadTopicArray[i], NS_ATTRIBUTE_TOPIC_NAME, topic->topicName);\r
NSCacheTopicSubData * topicSubData =\r
(NSCacheTopicSubData *) OICMalloc(sizeof(NSCacheTopicSubData));\r
\r
- OICStrcpy(topicSubData->id, consumerId, NS_UUID_STRING_SIZE);\r
+ OICStrcpy(topicSubData->id, NS_UUID_STRING_SIZE, consumerId);\r
topicSubData->topicName = OICStrdup(topicName);\r
\r
NSCacheElement * newObj = (NSCacheElement *) OICMalloc(sizeof(NSCacheElement));\r
- newObj->data = topicSubData;\r
+ newObj->data = (NSCacheData *) topicSubData;\r
newObj->next = NULL;\r
NSStorageWrite(consumerTopicList, newObj);\r
}\r