package org.iotivity.bridge.homeserver;

import org.iotivity.bridge.homeserver.IBridgeServiceCallback;
import org.iotivity.bridge.homeserver.IBridgeActivityCallback;

interface IBridgeService {

    /**
     * Often you want to allow a service to call back to its clients.
     * This shows how to do so, by registering a callback interface with
     * the service.
     */
    void registerActivityCallback(IBridgeActivityCallback cb);

    /**
     * Remove a previously registered activity callback interface.
     */
    void unregisterActivityCallback(IBridgeActivityCallback cb);

    /**
     * Request the PID of this service, to do evil things with it.
     */
    int getPid();

    /**
     * Often you want to allow a Service to call back to its clients.
     * This shows how to do so, by registering a callback interface with
     * the service.
     */
    void registerBridgeServiceCallback(IBridgeServiceCallback cb);

    /**
     * Remove a previously registered service callback interface.
     */
    void unregisterBridgeServiceCallback(IBridgeServiceCallback cb);

    /**
     * retrieve all on-line device list in BridgeService
     * @return devices list data with json array format as String
     * [{"name":"Light Switch","di":"15ba3c25-8cdd-41f8-6f9e-fe49105dce0a","piid":"2b32e152-3756-4fb6-b3f2-d8db7aafe39f","icv":"ocf.2.0.0","dmv":"ocf.res.1.3.0,ocf.sh.1.3.0"},
     * {"name":"Television","di":"4e7bf95f-1658-4a43-7f78-44522db5255f","piid":"2cd8e585-ef21-4fd1-7958-6ca7e54adcce","icv":"ocf.2.0.0","dmv":"ocf.res.1.3.0, ocf.sh.1.3.0"}]
     */
    String retrieveAllDevices();

    /**
     * retrieve all resources of the pair-wised deivce in BridgeService
     * @param device_uuid : unique identity of ocf device (eg. 15ba3c25-8cdd-41f8-6f9e-fe49105dce0a)
     * @return resource list data with json array format as String
     * [{"anchor":"ocf://15ba3c25-8cdd-41f8-6f9e-fe49105dce0a","uri”:”/light","rt":"[oic.r.switch.binary]","eps":"[coaps://192.168.0.3:43370]","if":"BASELINE | RW","pm":"DISCOVERABLE | OBSERVABLE"},
     * {"anchor":"ocf://15ba3c25-8cdd-41f8-6f9e-fe49105dce0a","uri":"/dimming","rt":"[oic.r.light.dimming]","eps":"[coaps://192.168.0.3:43370]","if":"BASELINE | RW","pm":"DISCOVERABLE | OBSERVABLE"}]
     */
    String retrieveAllResources(in String device_uuid) ;

    /**
     * request Getting all properties of the resource to the pair-wised OCF device
     * @param device_uuid unique identity of ocf device (eg. 15ba3c25-8cdd-41f8-6f9e-fe49105dce0a)
     * @param resource_uri uri of ocf resource (eg. /a/light)
     * @return
     *   - true : function call success,
     *   - false : function call fail
     */
    boolean requestGetProperties(in String device_uuid, in String resource_uri) ;

    /**
     * request Posting the value of properties to the pair-wised OCF device
     * @param device_uuid unique identity of ocf device (eg. 15ba3c25-8cdd-41f8-6f9e-fe49105dce0a)
     * @param resource_uri uri of ocf resource (eg. /a/light)
     * @param prop_data the property values of the resource (eg. { "power" : true, "level" : 100 }
     * @return
     *   - true : function call success,
     *   - false : function call fail
     */
    boolean requestPostProperties(in String device_uuid, in String resource_uri, in String prop_data) ;

    /**
     * request Putting the value of properties to the pair-wised OCF device
     * @param device_uuid unique identity of ocf device (eg. 15ba3c25-8cdd-41f8-6f9e-fe49105dce0a)
     * @param resource_uri uri of ocf resource (eg. /a/light)
     * @param prop_data the property values of the resource (eg. { "power" : true, "level" : 100 }
     * @return
     *   - true : function call success,
     *   - false : function call fail
     */
    boolean requestPutProperties(String device_uuid, String resource_uri, String prop_data);

    /**
     * request Observing all properties of the resource to the pair-wised OCF device
     * @param device_uuid unique identity of ocf device (eg. 15ba3c25-8cdd-41f8-6f9e-fe49105dce0a)
     * @param resource_uri uri of ocf resource (eg. /a/light)
     * @return
     *   - true : function call success,
     *   - false : function call fail
     */
    boolean requestObserveResource(in String device_uuid, in String resource_uri) ;

    /**
     * request Stop Observing all properties of the resource to the pair-wised OCF device
     * @param device_uuid unique identity of ocf device (eg. 15ba3c25-8cdd-41f8-6f9e-fe49105dce0a)
     * @param resource_uri uri of ocf resource (eg. /a/light)
     * @return
     *   - true : function call success,
     *   - false : function call fail
     */
    boolean requestStopObserveResource(in String device_uuid, in String resource_uri) ;

    /**
     * request Observing only device specific resources to the pair-wised OCF device
     * @param device_uuid unique identity of ocf device (eg. 15ba3c25-8cdd-41f8-6f9e-fe49105dce0a)
     * @return
     *   - true : function call success,
     *   - false : function call fail
     */
    boolean requestObserveDeviceSpecificResources(in String device_uuid) ;

    /**
     * request Stop Observing only device specific resources to the pair-wised OCF device
     * @param device_uuid unique identity of ocf device (eg. 15ba3c25-8cdd-41f8-6f9e-fe49105dce0a)
     * @return
     *   - true : function call success,
     *   - false : function call fail
     */
    boolean requestStopObserveDeviceSpecificResources(in String device_uuid) ;

}
