Merge branch 'notification-service' to master branch.
authorKIM JungYong <jyong2.kim@samsung.com>
Mon, 12 Dec 2016 10:52:30 +0000 (19:52 +0900)
committerJungYong KIM <jyong2.kim@samsung.com>
Tue, 13 Dec 2016 04:19:08 +0000 (04:19 +0000)
in this patch, Notification MQ functionality is added

Improvement:https://jira.iotivity.org/browse/IOT-1523
Change-Id: I59a102b6a188371c293accf55f3df872752705b9
Signed-off-by: KIM JungYong <jyong2.kim@samsung.com>
15 files changed:
1  2 
service/notification/SConscript
service/notification/android/notification-service/src/main/java/org/iotivity/service/ns/consumer/ConsumerService.java
service/notification/android/notification-service/src/main/java/org/iotivity/service/ns/provider/ProviderService.java
service/notification/android/notification-service/src/main/jni/consumer/JniNotificationConsumer.cpp
service/notification/android/notification-service/src/main/jni/provider/JniNotificationProvider.cpp
service/notification/cpp-wrapper/examples/linux/SConscript
service/notification/examples/android/NotiConsumerExample/app/src/main/java/com/sec/noticonsumerexample/MainActivity.java
service/notification/examples/android/NotiProviderExample/app/src/main/java/com/sec/notiproviderexample/MainActivity.java
service/notification/examples/linux/SConscript
service/notification/include/NSCommon.h
service/notification/src/common/NSConstants.h
service/notification/src/common/NSStructs.h
service/notification/src/consumer/NSConsumerCommon.c
service/notification/src/provider/NSProviderListener.c
service/notification/src/provider/NSProviderSystem.h

Simple merge
@@@ -268,4 -347,204 +347,233 @@@ public class MainActivity extends Activ
              }\r
          }\r
      };\r
 -            mAccountManager.signOut(this);\r
+     public void logMessage(final String text) {\r
+         runOnUiThread(new Runnable() {\r
+             public void run() {\r
+                 Message msg = new Message();\r
+                 msg.obj = text;\r
+                 TvLog.append(text + "\n");\r
+             }\r
+         });\r
+         Log.i(TAG, text);\r
+     }\r
+     OcAccountManager.OnPostListener onSignUp = new OcAccountManager.OnPostListener() {\r
+         @Override\r
+         public synchronized void onPostCompleted(List<OcHeaderOption> list,\r
+                                                  OcRepresentation ocRepresentation) {\r
+             logMessage("signUp was successful");\r
+             runOnUiThread(new Runnable() {\r
+                 public void run() {\r
+                     signIn.setEnabled(true);\r
+                     signUp.setEnabled(false);\r
+                 }\r
+             });\r
+             try {\r
+                 mUserID = ocRepresentation.getValue("uid");\r
+                 mAccessToken = ocRepresentation.getValue("accesstoken");\r
+                 mRefreshtoken = ocRepresentation.getValue("refreshtoken");\r
\r
+                 logMessage("\tuserID: " + mUserID);\r
+                 logMessage("\taccessToken: " + mAccessToken);\r
+                 logMessage("\trefreshToken: " + mRefreshtoken);\r
\r
+                 if (ocRepresentation.hasAttribute("expiresin")) {\r
+                     int expiresIn = ocRepresentation.getValue("expiresin");\r
+                     logMessage("\texpiresIn: " + expiresIn);\r
+                 }\r
+             } catch (OcException e) {\r
+                 Log.e(TAG, e.toString());\r
+             }\r
+         }\r
\r
\r
+         @Override\r
+         public synchronized void onPostFailed(Throwable throwable) {\r
+             logMessage("Failed to signUp");\r
+             if (throwable instanceof OcException) {\r
+                 OcException ocEx = (OcException) throwable;\r
+                 Log.e(TAG, ocEx.toString());\r
+                 ErrorCode errCode = ocEx.getErrorCode();\r
+                 logMessage("Error code: " + errCode);\r
+             }\r
+         }\r
+     };\r
+     OcAccountManager.OnPostListener onSignIn = new OcAccountManager.OnPostListener() {\r
+         @Override\r
+         public synchronized void onPostCompleted(List<OcHeaderOption> list,\r
+                                                  OcRepresentation ocRepresentation) {\r
+             logMessage("signIn was successful");\r
+             runOnUiThread(new Runnable() {\r
+                 public void run() {\r
+                     signIn.setEnabled(false);\r
+                     signOut.setEnabled(true);\r
+                     btnEnableRemoteService.setEnabled(true);\r
+                 }\r
+             });\r
\r
+         }\r
\r
+         @Override\r
+         public synchronized void onPostFailed(Throwable throwable) {\r
+             logMessage("Failed to signIn");\r
+             if (throwable instanceof OcException) {\r
+                 OcException ocEx = (OcException) throwable;\r
+                 Log.e(TAG, ocEx.toString());\r
+                 ErrorCode errCode = ocEx.getErrorCode();\r
+                 logMessage("Error code: " + errCode);\r
+                 if (ErrorCode.UNAUTHORIZED_REQ != errCode) {\r
+                     RefreshToken();\r
+                 }\r
+             }\r
+         }\r
+     };\r
++    OcAccountManager.OnPostListener onSignOut = new OcAccountManager.OnPostListener() {\r
++        @Override\r
++        public synchronized void onPostCompleted(List<OcHeaderOption> list,\r
++                                                 OcRepresentation ocRepresentation) {\r
++            logMessage("signOut was successful");\r
++            runOnUiThread(new Runnable() {\r
++                public void run() {\r
++                    signIn.setEnabled(true);\r
++                    signOut.setEnabled(false);\r
++                    btnEnableRemoteService.setEnabled(false);\r
++                }\r
++            });\r
++\r
++        }\r
++\r
++        @Override\r
++        public synchronized void onPostFailed(Throwable throwable) {\r
++            logMessage("Failed to signOut");\r
++            if (throwable instanceof OcException) {\r
++                OcException ocEx = (OcException) throwable;\r
++                Log.e(TAG, ocEx.toString());\r
++                ErrorCode errCode = ocEx.getErrorCode();\r
++                logMessage("Error code: " + errCode);\r
++                if (ErrorCode.UNAUTHORIZED_REQ != errCode) {\r
++                    RefreshToken();\r
++                }\r
++            }\r
++        }\r
++    };\r
+     @Override\r
+     public void onPostCompleted(List<OcHeaderOption> ocHeaderOptions, OcRepresentation ocRepresentation) {\r
\r
+     }\r
\r
+     @Override\r
+     public void onPostFailed(Throwable throwable) {\r
\r
+     }\r
+     private void signIn() {\r
+         try {\r
+             if(mAccountManager==null)\r
+             {\r
+                 mAccountManager = OcPlatform.constructAccountManagerObject(CIServer,\r
+                         EnumSet.of(OcConnectivityType.CT_ADAPTER_TCP));\r
+             }\r
\r
+             mAccountManager.signIn(mUserID, mAccessToken, onSignIn);\r
+         } catch (OcException e) {\r
+             e.printStackTrace();\r
+         }\r
+     }\r
\r
+     private void signOut() {\r
+         try {\r
+             logMessage("signOut");\r
+             if(mAccountManager==null)\r
+             {\r
+                 try {\r
+                     mAccountManager = OcPlatform.constructAccountManagerObject(CIServer,\r
+                             EnumSet.of(OcConnectivityType.CT_ADAPTER_TCP));\r
+                 } catch (OcException e) {\r
+                     e.printStackTrace();\r
+                 }\r
+             }\r
++            mAccountManager.signOut(mAccessToken, onSignOut);\r
+             signIn.setEnabled(false);\r
+             signUp.setEnabled(true);\r
+             btnEnableRemoteService.setEnabled(false);\r
+             logMessage("signOut Successful");\r
+         } catch (OcException e) {\r
+             e.printStackTrace();\r
+         }\r
+     }\r
\r
+     private void signUp() {\r
+         try {\r
+             mAccountManager = OcPlatform.constructAccountManagerObject(CIServer,\r
+                     EnumSet.of(OcConnectivityType.CT_ADAPTER_TCP));\r
+         } catch (OcException e) {\r
+             e.printStackTrace();\r
+         }\r
\r
+         Intent intentLogin = new Intent(this,LoginActivity.class);\r
+         startActivityForResult(intentLogin, REQUEST_LOGIN);\r
+     }\r
+     @Override\r
+     public void onActivityResult(int requestCode, int resultCode, Intent data) {\r
+         super.onActivityResult(requestCode, resultCode, data);\r
+         if (resultCode == Activity.RESULT_OK && requestCode == REQUEST_LOGIN) {\r
+             mAuthCode = data.getStringExtra("authCode");\r
+             mAuthProvider = data.getStringExtra("authProvider");\r
+             logMessage("authCode: " + mAuthCode);\r
+             logMessage("authProvider: " + mAuthProvider);\r
\r
+             try {\r
+                 mAccountManager = OcPlatform.constructAccountManagerObject(CIServer,\r
+                         EnumSet.of(OcConnectivityType.CT_ADAPTER_TCP));\r
+                 logMessage("Calling signup API");\r
\r
+                 mAccountManager.signUp(mAuthProvider, mAuthCode, onSignUp);\r
+             } catch (OcException e) {\r
+                 e.printStackTrace();\r
+             }\r
+         }\r
+     }\r
\r
+     OcResource.OnPostListener onRefreshTokenPost = new OcResource.OnPostListener() {\r
+         @Override\r
+         public void onPostCompleted(List<OcHeaderOption> list, OcRepresentation ocRepresentation) {\r
+             logMessage("RefreshToken Completed.");\r
+             try {\r
+                 mAccessToken = ocRepresentation.getValue("accesstoken");\r
+                 mRefreshtoken = ocRepresentation.getValue("refreshtoken");\r
+             }\r
+             catch (OcException e)\r
+             {\r
+                 e.printStackTrace();\r
+             }\r
+             signIn();\r
+         }\r
\r
+         @Override\r
+         public void onPostFailed(Throwable throwable) {\r
+             logMessage("RefreshToken failed.");\r
+             Log.d(TAG, "onRefreshTokenPost failed..");\r
+         }\r
+     };\r
+     public void RefreshToken() {\r
+         try {\r
+             OcResource authResource = OcPlatform.constructResourceObject(CIServer, "/.well-known/ocf/account/tokenrefresh",\r
+                     EnumSet.of(OcConnectivityType.CT_ADAPTER_TCP, OcConnectivityType.CT_IP_USE_V4),\r
+                     false, Arrays.asList("oic.wk.account"), Arrays.asList(OcPlatform.DEFAULT_INTERFACE));\r
+             OcRepresentation rep = new OcRepresentation();\r
\r
+             showToast("RefreshToken in progress..");\r
+             logMessage("RefreshToken in progress..");\r
+             rep.setValue("di", deviceID);\r
+             rep.setValue("granttype", "refresh_token");\r
+             rep.setValue("refreshtoken", mRefreshtoken);\r
+             rep.setValue("uid", mUserID);\r
+             authResource.post(rep, new HashMap<String, String>(), onRefreshTokenPost);\r
+         }\r
+         catch(OcException e)\r
+         {\r
+             e.printStackTrace();\r
+         }\r
\r
+         Log.d(TAG, "No error while executing login");\r
+     }\r
  }\r
@@@ -285,8 -324,274 +324,303 @@@ public class MainActivity extends Activ
  \r
                      TvLog.setText("");\r
                  }\r
-                 break;  }\r
+                 break;\r
+                 case R.id.signup: {\r
+                     if(isStarted == false) {\r
+                         Log.e(TAG, "Fail to Sign Up");\r
+                         showToast("Start ProviderService First");\r
+                         break;\r
+                     }\r
+                     TvLog.append("Initiating SignUp\n");\r
+                     signUp();\r
+                 }\r
+                 break;\r
+                 case R.id.signin: {\r
+                     if(isStarted == false) {\r
+                         Log.e(TAG, "Fail to Sign In");\r
+                         showToast("Start ProviderService First");\r
+                         break;\r
+                     }\r
+                     TvLog.append("Initiating SignIn\n");\r
+                     signIn();\r
+                 }\r
+                 break;\r
+                 case R.id.signout: {\r
+                     if(isStarted == false) {\r
+                         Log.e(TAG, "Fail to Sign out");\r
+                         showToast("Start ProviderService First");\r
+                         break;\r
+                     }\r
+                     TvLog.append("Initiating SignOut\n");\r
+                     signOut();\r
+                 }\r
+                 break;\r
+                 case R.id.remoteService: {\r
+                     remoteService.setEnabled(false);\r
+                     if(isStarted == false) {\r
+                         Log.e(TAG, "Fail to Enable/Disable RemoteService");\r
+                         showToast("Start ProviderService First");\r
+                         break;\r
+                     }\r
+                     if(gRemoteService){\r
+                         TvLog.append("Enable Remote Service\n");\r
+                         int result = mProviderSample.EnableRemoteService(RemoteAddress);\r
+                         remoteService.setText(R.string.disableRemoteService);\r
+                         gRemoteService = false;\r
+                         remoteService.setEnabled(true);\r
+                         TvLog.append("EnableRemoteService Result : " + result + "\n");\r
+                     }\r
+                     else {\r
+                         TvLog.append("Disable Remote Service\n");\r
+                         int result = mProviderSample.DisableRemoteService(RemoteAddress);\r
+                         remoteService.setText(R.string.enableRemoteService);\r
+                         gRemoteService = true;\r
+                         remoteService.setEnabled(true);\r
+                         TvLog.append("DisableRemoteService Result : " + result + "\n");\r
+                     }\r
+                 }\r
+                 break;\r
+                 case R.id.subscribeMQService: {\r
+                     if(isStarted == false) {\r
+                         Log.e(TAG, "Fail to SubscribeMQService");\r
+                         showToast("Start ProviderService First");\r
+                         break;\r
+                     }\r
+                     int result = mProviderSample.subscribeMQService(MQCloudAddress, MQCloudTopic);\r
+                     TvLog.append("SubscribeMQService Result : " + result + "\n");\r
+                 }\r
+                 break;\r
+             }\r
+         }\r
+     };\r
+     public void logMessage(final String text) {\r
+         runOnUiThread(new Runnable() {\r
+             public void run() {\r
+                 Message msg = new Message();\r
+                 msg.obj = text;\r
+                 TvLog.append(text + "\n");\r
+             }\r
+         });\r
+         Log.i(TAG, text);\r
+     }\r
+     OcAccountManager.OnPostListener onSignUp = new OcAccountManager.OnPostListener() {\r
+         @Override\r
+         public synchronized void onPostCompleted(List<OcHeaderOption> list,\r
+                                                  OcRepresentation ocRepresentation) {\r
+             logMessage("signUp was successful");\r
+             runOnUiThread(new Runnable() {\r
+                 public void run() {\r
+                     signIn.setEnabled(true);\r
+                     signUp.setEnabled(false);\r
+                 }\r
+             });\r
+             try {\r
+                 mUserID = ocRepresentation.getValue("uid");\r
+                 mAccessToken = ocRepresentation.getValue("accesstoken");\r
+                 mRefreshtoken = ocRepresentation.getValue("refreshtoken");\r
\r
+                 logMessage("\tuserID: " + mUserID);\r
+                 logMessage("\taccessToken: " + mAccessToken);\r
+                 logMessage("\trefreshToken: " + mRefreshtoken);\r
\r
+                 if (ocRepresentation.hasAttribute("expiresin")) {\r
+                     int expiresIn = ocRepresentation.getValue("expiresin");\r
+                     logMessage("\texpiresIn: " + expiresIn);\r
+                 }\r
+             } catch (OcException e) {\r
+                 Log.e(TAG, e.toString());\r
+             }\r
+         }\r
\r
\r
+         @Override\r
+         public synchronized void onPostFailed(Throwable throwable) {\r
+             logMessage("Failed to signUp");\r
+             if (throwable instanceof OcException) {\r
+                 OcException ocEx = (OcException) throwable;\r
+                 Log.e(TAG, ocEx.toString());\r
+                 ErrorCode errCode = ocEx.getErrorCode();\r
+                 logMessage("Error code: " + errCode);\r
+             }\r
+         }\r
+     };\r
+     OcAccountManager.OnPostListener onSignIn = new OcAccountManager.OnPostListener() {\r
+         @Override\r
+         public synchronized void onPostCompleted(List<OcHeaderOption> list,\r
+                                                  OcRepresentation ocRepresentation) {\r
+             logMessage("signIn was successful");\r
+             runOnUiThread(new Runnable() {\r
+                 public void run() {\r
+                     signIn.setEnabled(false);\r
+                     signOut.setEnabled(true);\r
+                     remoteService.setEnabled(true);\r
+                 }\r
+             });\r
\r
+         }\r
\r
+         @Override\r
+         public synchronized void onPostFailed(Throwable throwable) {\r
+             logMessage("Failed to signIn");\r
+             if (throwable instanceof OcException) {\r
+                 OcException ocEx = (OcException) throwable;\r
+                 Log.e(TAG, ocEx.toString());\r
+                 ErrorCode errCode = ocEx.getErrorCode();\r
+                 logMessage("Error code: " + errCode);\r
+                 if (ErrorCode.UNAUTHORIZED_REQ != errCode) {\r
+                     RefreshToken();\r
+                 }\r
+             }\r
+         }\r
+     };\r
++    OcAccountManager.OnPostListener onSignOut = new OcAccountManager.OnPostListener() {\r
++        @Override\r
++        public synchronized void onPostCompleted(List<OcHeaderOption> list,\r
++                                                 OcRepresentation ocRepresentation) {\r
++            logMessage("signOut was successful");\r
++            runOnUiThread(new Runnable() {\r
++                public void run() {\r
++                    signIn.setEnabled(true);\r
++                    signOut.setEnabled(false);\r
++                    remoteService.setEnabled(false);\r
++                }\r
++            });\r
++\r
++        }\r
++\r
++        @Override\r
++        public synchronized void onPostFailed(Throwable throwable) {\r
++            logMessage("Failed to signOut");\r
++            if (throwable instanceof OcException) {\r
++                OcException ocEx = (OcException) throwable;\r
++                Log.e(TAG, ocEx.toString());\r
++                ErrorCode errCode = ocEx.getErrorCode();\r
++                logMessage("Error code: " + errCode);\r
++                if (ErrorCode.UNAUTHORIZED_REQ != errCode) {\r
++                    RefreshToken();\r
++                }\r
++            }\r
++        }\r
++    };\r
+     @Override\r
+     public void onPostCompleted(List<OcHeaderOption> ocHeaderOptions, OcRepresentation ocRepresentation) {\r
\r
+     }\r
\r
+     @Override\r
+     public void onPostFailed(Throwable throwable) {\r
\r
+     }\r
+     private void signIn() {\r
+         try {\r
+             if(mAccountManager==null)\r
+             {\r
+                 mAccountManager = OcPlatform.constructAccountManagerObject(CIServer,\r
+                         EnumSet.of(OcConnectivityType.CT_ADAPTER_TCP));\r
+             }\r
\r
+             mAccountManager.signIn(mUserID, mAccessToken, onSignIn);\r
+         } catch (OcException e) {\r
+             e.printStackTrace();\r
+         }\r
+     }\r
\r
+     private void signOut() {\r
+         try {\r
+             logMessage("signOut");\r
+             if(mAccountManager==null)\r
+             {\r
+                 try {\r
+                     mAccountManager = OcPlatform.constructAccountManagerObject(CIServer,\r
+                             EnumSet.of(OcConnectivityType.CT_ADAPTER_TCP));\r
+                 } catch (OcException e) {\r
+                     e.printStackTrace();\r
+                 }\r
+             }\r
 -            mAccountManager.signOut(this);\r
++            mAccountManager.signOut(mAccessToken, onSignOut);\r
+             signIn.setEnabled(false);\r
+             signUp.setEnabled(true);\r
+             remoteService.setEnabled(false);\r
+             logMessage("signOut Successful");\r
+         } catch (OcException e) {\r
+             e.printStackTrace();\r
+         }\r
+     }\r
\r
+     private void signUp() {\r
+         try {\r
+             mAccountManager = OcPlatform.constructAccountManagerObject(CIServer,\r
+                     EnumSet.of(OcConnectivityType.CT_ADAPTER_TCP));\r
+         } catch (OcException e) {\r
+             e.printStackTrace();\r
+         }\r
\r
+         Intent intentLogin = new Intent(this, LoginActivity.class);\r
+         startActivityForResult(intentLogin, REQUEST_LOGIN);\r
+     }\r
+     @Override\r
+     public void onActivityResult(int requestCode, int resultCode, Intent data) {\r
+         super.onActivityResult(requestCode, resultCode, data);\r
+         if (resultCode == Activity.RESULT_OK && requestCode == REQUEST_LOGIN) {\r
+             mAuthCode = data.getStringExtra("authCode");\r
+             mAuthProvider = data.getStringExtra("authProvider");\r
+             logMessage("authCode: " + mAuthCode);\r
+             logMessage("authProvider: " + mAuthProvider);\r
\r
+             try {\r
+                 mAccountManager = OcPlatform.constructAccountManagerObject(CIServer,\r
+                         EnumSet.of(OcConnectivityType.CT_ADAPTER_TCP));\r
+                 logMessage("Calling signup API");\r
\r
+                 mAccountManager.signUp(mAuthProvider, mAuthCode, onSignUp);\r
+             } catch (OcException e) {\r
+                 e.printStackTrace();\r
              }\r
+         }\r
+     }\r
\r
+     OcResource.OnPostListener onRefreshTokenPost = new OcResource.OnPostListener() {\r
+         @Override\r
+         public void onPostCompleted(List<OcHeaderOption> list, OcRepresentation ocRepresentation) {\r
+             logMessage("RefreshToken Completed.");\r
+             try {\r
+                 mAccessToken = ocRepresentation.getValue("accesstoken");\r
+                 mRefreshtoken = ocRepresentation.getValue("refreshtoken");\r
+             }\r
+             catch (OcException e)\r
+             {\r
+                 e.printStackTrace();\r
+             }\r
+             signIn();\r
+         }\r
\r
+         @Override\r
+         public void onPostFailed(Throwable throwable) {\r
+             logMessage("RefreshToken failed.");\r
+             Log.d(TAG, "onRefreshTokenPost failed..");\r
+         }\r
      };\r
+     public void RefreshToken() {\r
+         try {\r
+             OcResource authResource = OcPlatform.constructResourceObject(CIServer, "/.well-known/ocf/account/tokenrefresh",\r
+                     EnumSet.of(OcConnectivityType.CT_ADAPTER_TCP, OcConnectivityType.CT_IP_USE_V4),\r
+                     false, Arrays.asList("oic.wk.account"), Arrays.asList(OcPlatform.DEFAULT_INTERFACE));\r
+             OcRepresentation rep = new OcRepresentation();\r
\r
+             showToast("RefreshToken in progress..");\r
+             logMessage("RefreshToken in progress..");\r
+             rep.setValue("di", deviceID);\r
+             rep.setValue("granttype", "refresh_token");\r
+             rep.setValue("refreshtoken", mRefreshtoken);\r
+             rep.setValue("uid", mUserID);\r
+             authResource.post(rep, new HashMap<String, String>(), onRefreshTokenPost);\r
+         }\r
+         catch(OcException e)\r
+         {\r
+             e.printStackTrace();\r
+         }\r
\r
+         Log.d(TAG, "No error while executing login");\r
+     }\r
  }\r
  \r
@@@ -65,6 -66,22 +65,19 @@@ if env.get('WITH_TCP') == True
        if env.get('SECURED') == '1':
                notification_sample_env.AppendUnique(LIBS = ['mbedtls', 'mbedx509', 'mbedcrypto'])
  
 -if 'CLIENT' in rd_mode or 'SERVER' in rd_mode:
 -    notification_sample_env.AppendUnique(LIBS = ['resource_directory'])
 -
+ with_mq = env.get('WITH_MQ')
+ if 'SUB' in with_mq:
+     notification_sample_env.AppendUnique(CPPDEFINES = ['MQ_SUBSCRIBER', 'WITH_MQ'])
+     print "MQ SUB support"
+ if 'PUB' in with_mq:
+     notification_sample_env.AppendUnique(CPPDEFINES = ['MQ_PUBLISHER', 'WITH_MQ'])
+     print "MQ PUB support"
+ if 'BROKER' in with_mq:
+     notification_sample_env.AppendUnique(CPPDEFINES = ['MQ_BROKER', 'WITH_MQ'])
+     print "MQ Broker support"
  ####################################################################
  # Source files and Targets
  ######################################################################
@@@ -81,7 -81,8 +81,9 @@@ typedef enu
      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;
  
  
  #include <pthread.h>
  
 -#define NS_QUERY_CONSUMER_ID "consumerId"
 -
+ static bool NSIsExtraValue(const char * name);
+ static void NSCopyPayloadValueArray(OCRepPayloadValue* dest, OCRepPayloadValue* source);
+ static OCRepPayloadValue * NSCopyPayloadValue(OCRepPayloadValue * value);
  pthread_mutex_t ** NSGetStackMutex()
  {
      static pthread_mutex_t * g_stackMutext = NULL;
@@@ -41,6 -41,11 +41,11 @@@ void NSSetPolicy(bool policy)
  bool NSGetResourceSecurity();\r
  void NSSetResourceSecurity(bool secured);\r
  \r
 -\r
+ #ifdef WITH_MQ\r
+ void NSSetMQServerInfo(const char * serverUri, OCDevAddr * devAddr);\r
+ NSMQServerInfo * NSGetMQServerInfo();\r
+ #endif\r
++
  #if (defined WITH_CLOUD && defined RD_CLIENT)\r
  void NSSetRemoteServerAddress(char *serverAddress);\r
  void NSDeleteRemoteServerAddress(char *serverAddress);\r