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;
25 public class NSProvider {
27 private static final String LOG_TAG = "ConsumerService_NSProvider";
29 String providerId = null;
31 private long mNativeHandle = 0;
33 public NSProvider(String providerId, long mNativeHandle) {
34 Log.i (LOG_TAG, "NSProvider()");
36 this.providerId = providerId;
38 this.mNativeHandle = mNativeHandle;
41 private native void Subscribe(long provider) throws NSException;
42 private native void Unsubscribe(long provider) throws NSException;
43 private native void SendSyncInfo(String providerId, long messageId, int syncType) throws NSException;
44 public native void SetListener(
45 ConsumerService.OnMessageReceivedListner onMessageReceivedListner,
46 ConsumerService.OnSyncInfoReceivedListner onSyncInfoReceivedListner
49 public String getProviderId () {
53 public void Subscribe() throws NSException {
54 this.Subscribe(mNativeHandle);
57 public void Unsubscribe() throws NSException {
58 this.Unsubscribe(mNativeHandle);
61 public void SendSyncInfo(long messageId, int syncType) throws NSException {
62 this.SendSyncInfo(this.providerId, messageId, syncType);