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.*;
28 * @brief This class provides implementation of Notification Provider object.
32 private static final String LOG_TAG = "ConsumerService_Provider";
34 public String mProviderId = null;
35 private long mNativeHandle = 0;
37 public Provider(String providerId)
39 Log.i (LOG_TAG, "Provider()");
41 mProviderId = providerId;
44 public String getProviderId()
49 public void Subscribe() throws NSException
54 public void Unsubscribe() throws NSException
59 public void SendSyncInfo(long messageId, SyncInfo.SyncType syncType) throws NSException
61 nativeSendSyncInfo(messageId, syncType.ordinal());
64 public void SetListener(OnMessageReceivedListner onMessageReceivedListner,
65 OnSyncInfoReceivedListner onSyncInfoReceivedListner) throws NSException
67 nativeSetListener(onMessageReceivedListner, onSyncInfoReceivedListner);
70 public interface OnMessageReceivedListner
72 public void onMessageReceived(Message message);
75 public interface OnSyncInfoReceivedListner
77 public void onSyncInfoReceived(SyncInfo sync);
80 private native void nativeSubscribe() throws NSException;
81 private native void nativeUnsubscribe() throws NSException;
82 private native void nativeSendSyncInfo(long messageId, int syncType) throws NSException;
83 private native void nativeSetListener(
84 OnMessageReceivedListner onMessageReceivedListner,
85 OnSyncInfoReceivedListner onSyncInfoReceivedListner