Add callback interface and open source license term.
[platform/upstream/iotivity.git] / service / notification / android / notification-service / src / main / java / org / iotivity / service / notification / IoTNotification.java
index ca22906..3bea94e 100644 (file)
@@ -1,36 +1,35 @@
-package org.iotivity.service.notification;\r
-\r
-import android.util.Log;\r
-import org.iotivity.service.notification.NSMessage;\r
-import org.iotivity.service.notification.NSConsumer;\r
-import org.iotivity.service.notification.NSSync;\r
-\r
-public class IoTNotification {\r
-    public IoTNotification(){}\r
-\r
-    static {\r
-        System.loadLibrary("notification_provider_jni");\r
-    }\r
-\r
-    public void onLogPrinted(String log)\r
-    {\r
-        Log.i("JNI_NS_CALLBACK", "[C->J] Log: " + log);\r
-    }\r
-\r
-    public void onSubscribeRequest(String consumer)\r
-    {\r
-        Log.i("JNI_NS_CALLBACK", "[C->J] Consumer IP: " + consumer);\r
-    }\r
-\r
-    public void onMessageSync(String sync)\r
-    {\r
-        Log.i("JNI_NS_CALLBACK", "[C->J] Sync Status" + sync);\r
-    }\r
-      \r
-    public native int NSStartProvider(boolean access);\r
-    public native int NSStopProvider();\r
-    public native int NSSendNotification(NSMessage message);\r
-    public native int NSProviderReadCheck(NSMessage message);\r
-    public native int NSAccept(NSConsumer consumer, boolean accepted);\r
-}\r
-\r
+package org.iotivity.service.notification;
+
+import android.util.Log;
+import org.iotivity.service.notification.NSMessage;
+import org.iotivity.service.notification.NSConsumer;
+import org.iotivity.service.notification.NSSync;
+
+public class IoTNotification
+{
+    public IoTNotification()
+    {
+    }
+
+    static
+    {
+        System.loadLibrary("notification_provider_jni");
+    }
+
+    public native int NSStartProvider(boolean access,
+        NSSubscriptionListner subscriptionListener,
+        NSSynchListner syncListener);
+    public native int NSStopProvider();
+    public native int NSSendNotification(NSMessage message);
+    public native int NSProviderReadCheck(NSMessage message);
+    public native int NSAccept(NSConsumer consumer, boolean accepted);
+
+    public interface NSSubscriptionListner {
+        public void OnNSSubscribedEvent(String consumerId);
+    }
+
+    public interface NSSynchListner {
+        public void OnNSSynchronizedEvent(String messageId, int syncState);
+    }
+}
+