Interface AnjayObjectAttrHandlers


  • public interface AnjayObjectAttrHandlers
    Interface specifying handlers for reading and writing attributes.

    LwM2M Object may implement them to override default implementation from AnjayAttrStorage, if installed, or to make the attributes support working if AnjayAttrStorage is not installed.

    • Method Detail

      • objectReadDefaultAttrs

        default AnjayAttributes.ObjectInstanceAttrs objectReadDefaultAttrs​(int ssid)
                                                                    throws java.lang.Exception
        A handler that returns default attribute values set for the Object.
        Parameters:
        ssid - Short Server ID of the server requesting the RPC.
        Returns:
        Attributes for the Object.
        Throws:
        java.lang.Exception - In case of error. If AnjayException is thrown with one of defined error codes, the response message will have an appropriate CoAP response code. Otherwise, the device will respond with an unspecified (but valid) error code.
      • objectWriteDefaultAttrs

        default void objectWriteDefaultAttrs​(int ssid,
                                             AnjayAttributes.ObjectInstanceAttrs attrs)
                                      throws java.lang.Exception
        A handler that sets default attribute values for the Object.
        Parameters:
        ssid - Short Server ID of the server requesting the RPC.
        attrs - Attributes to be set for the Object.
        Throws:
        java.lang.Exception - In case of error. If AnjayException is thrown with one of defined error codes, the response message will have an appropriate CoAP response code. Otherwise, the device will respond with an unspecified (but valid) error code.
      • instanceReadDefaultAttrs

        default AnjayAttributes.ObjectInstanceAttrs instanceReadDefaultAttrs​(int iid,
                                                                             int ssid)
                                                                      throws java.lang.Exception
        A handler that returns default attributes set for the Object Instance.
        Parameters:
        iid - Checked Object Instance ID.
        ssid - Short Server ID of the server requesting the RPC.
        Returns:
        Attributes for the Object Instance.
        Throws:
        java.lang.Exception - In case of error. If AnjayException is thrown with one of defined error codes, the response message will have an appropriate CoAP response code. Otherwise, the device will respond with an unspecified (but valid) error code.
      • instanceWriteDefaultAttrs

        default void instanceWriteDefaultAttrs​(int iid,
                                               int ssid,
                                               AnjayAttributes.ObjectInstanceAttrs attrs)
                                        throws java.lang.Exception
        A handler that sets default attributes for the Object Instance.
        Parameters:
        iid - Checked Object Instance ID.
        ssid - Short Server ID of the server requesting the RPC.
        attrs - Attributes to set for the Object Instance.
        Throws:
        java.lang.Exception - In case of error. If AnjayException is thrown with one of defined error codes, the response message will have an appropriate CoAP response code. Otherwise, the device will respond with an unspecified (but valid) error code.
      • resourceReadAttrs

        default AnjayAttributes.ResourceAttrs resourceReadAttrs​(int iid,
                                                                int rid,
                                                                int ssid)
                                                         throws java.lang.Exception
        A handler that returns Resource attributes.
        Parameters:
        iid - Object Instance ID.
        rid - Resource ID.
        ssid - Short Server ID of the LwM2M Server issuing the request.
        Returns:
        Attributes for the resource.
        Throws:
        java.lang.Exception - In case of error. If AnjayException is thrown with one of defined error codes, the response message will have an appropriate CoAP response code. Otherwise, the device will respond with an unspecified (but valid) error code.
      • resourceWriteAttrs

        default void resourceWriteAttrs​(int iid,
                                        int rid,
                                        int ssid,
                                        AnjayAttributes.ResourceAttrs attrs)
                                 throws java.lang.Exception
        A handler that sets attributes for given Resource.
        Parameters:
        iid - Object Instance ID.
        rid - Resource ID.
        ssid - Short Server ID of the LwM2M Server issuing the request.
        attrs - Attributes to set for this Resource.
        Throws:
        java.lang.Exception - In case of error. If AnjayException is thrown with one of defined error codes, the response message will have an appropriate CoAP response code. Otherwise, the device will respond with an unspecified (but valid) error code.