1 //******************************************************************
3 // Copyright 2016 Samsung Electronics All Rights Reserved.
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
11 // http://www.apache.org/licenses/LICENSE-2.0
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an "AS IS" BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
21 package org.iotivity.service.ns.consumer;
23 import android.util.Log;
24 import org.iotivity.service.ns.common.*;
25 import java.util.Vector;
29 * @brief This class provides implementation of Notification Provider object.
33 private static final String LOG_TAG = "ConsumerService_Provider";
35 public String mProviderId = null;
36 TopicsList mTopicsList = new TopicsList();
37 private long mNativeHandle = 0;
39 public Provider(String providerId)
41 Log.i (LOG_TAG, "Provider()");
43 mProviderId = providerId;
46 public String getProviderId()
51 public TopicsList getTopicsList()
56 public void Subscribe() throws NSException
61 public void Unsubscribe() throws NSException
66 public void SendSyncInfo(long messageId, SyncInfo.SyncType syncType) throws NSException
68 nativeSendSyncInfo(messageId, syncType.ordinal());
71 public void SetListener(OnMessageReceivedListner onMessageReceivedListner,
72 OnSyncInfoReceivedListner onSyncInfoReceivedListner) throws NSException
74 nativeSetListener(onMessageReceivedListner, onSyncInfoReceivedListner);
77 public int SelectInterestTopics(TopicsList topicsList) throws NSException
79 return nativeSelectInterestTopics(topicsList);
82 public interface OnMessageReceivedListner
84 public void onMessageReceived(Message message);
87 public interface OnSyncInfoReceivedListner
89 public void onSyncInfoReceived(SyncInfo sync);
92 private native void nativeSubscribe() throws NSException;
93 private native void nativeUnsubscribe() throws NSException;
94 private native void nativeSendSyncInfo(long messageId, int syncType) throws NSException;
95 private native void nativeSetListener(
96 OnMessageReceivedListner onMessageReceivedListner,
97 OnSyncInfoReceivedListner onSyncInfoReceivedListner
99 private native int nativeSelectInterestTopics(TopicsList topicsList) throws NSException;