1 package org.iotivity.service;
3 import android.content.Context;
5 public class RMInterface {
8 // Load RI JNI interface
9 System.loadLibrary("RMInterface");
12 private org.iotivity.service.MainActivity mResponseListener = null;
14 public native void setNativeResponseListener(Object listener);
16 public native void RMInitialize(Context context);
18 public native void RMTerminate();
20 public native void RMStartListeningServer();
22 public native void RMStartDiscoveryServer();
24 public native void RMRegisterHandler();
26 public native void RMFindResource(String uri);
28 public native void RMSendRequest(String uri, String payload,
29 int selectedNetwork, int isSecured, int msgType);
31 public native void RMSendReqestToAll(String uri, int selectedNetwork);
33 public native void RMSendResponse(int selectedNetwork, int isSecured,
34 int msgType, int responseValue);
36 public native void RMAdvertiseResource(String advertiseResource);
38 public native void RMSendNotification(String uri, String payload,
39 int selectedNetwork, int isSecured, int msgType, int responseValue);
41 public native void RMSelectNetwork(int interestedNetwork);
43 public native void RMUnSelectNetwork(int uninterestedNetwork);
45 public native void RMGetNetworkInfomation();
47 public native void RMHandleRequestResponse();
49 public void setResponseListener(org.iotivity.service.MainActivity listener) {
50 mResponseListener = listener;
51 setNativeResponseListener(this);
54 private void OnResponseReceived(String subject, String receivedData) {
55 if (null != mResponseListener) {
56 mResponseListener.OnResponseReceived(subject, receivedData);