Skip to main content

ServiceHandler

Trait ServiceHandler 

Source
pub trait ServiceHandler:
    Send
    + Sync
    + 'static {
    // Required methods
    fn read_property(
        &self,
        object_id: ObjectId,
        property_id: PropertyId,
        array_index: Option<u32>,
    ) -> Result<ClientDataValue, BacnetServiceError>;
    fn write_property(
        &self,
        object_id: ObjectId,
        property_id: PropertyId,
        array_index: Option<u32>,
        value: ClientDataValue,
        priority: Option<u8>,
    ) -> Result<(), BacnetServiceError>;

    // Provided methods
    fn write_property_multiple(
        &self,
        _specs: &[(ObjectId, Vec<(PropertyId, Option<u32>, ClientDataValue, Option<u8>)>)],
    ) -> Result<(), BacnetServiceError> { ... }
    fn create_object(
        &self,
        _object_type: ObjectType,
    ) -> Result<ObjectId, BacnetServiceError> { ... }
    fn delete_object(
        &self,
        _object_id: ObjectId,
    ) -> Result<(), BacnetServiceError> { ... }
    fn subscribe_cov(
        &self,
        _subscriber_process_id: u32,
        _monitored_object_id: ObjectId,
        _issue_confirmed: bool,
        _lifetime: Option<u32>,
    ) -> Result<(), BacnetServiceError> { ... }
}
Expand description

Handler trait that the server calls for each incoming service request.

Required Methods§

Source

fn read_property( &self, object_id: ObjectId, property_id: PropertyId, array_index: Option<u32>, ) -> Result<ClientDataValue, BacnetServiceError>

Called for a ReadProperty confirmed request.

Source

fn write_property( &self, object_id: ObjectId, property_id: PropertyId, array_index: Option<u32>, value: ClientDataValue, priority: Option<u8>, ) -> Result<(), BacnetServiceError>

Called for a WriteProperty confirmed request.

Provided Methods§

Source

fn write_property_multiple( &self, _specs: &[(ObjectId, Vec<(PropertyId, Option<u32>, ClientDataValue, Option<u8>)>)], ) -> Result<(), BacnetServiceError>

Called for a WritePropertyMultiple confirmed request.

Each element of specs is (object_id, vec_of_(property_id, array_index, value, priority)). The default implementation rejects with BacnetServiceError::WriteAccessDenied.

Source

fn create_object( &self, _object_type: ObjectType, ) -> Result<ObjectId, BacnetServiceError>

Called for a CreateObject confirmed request.

The default implementation rejects with BacnetServiceError::WriteAccessDenied.

Source

fn delete_object(&self, _object_id: ObjectId) -> Result<(), BacnetServiceError>

Called for a DeleteObject confirmed request.

The default implementation rejects with BacnetServiceError::WriteAccessDenied.

Source

fn subscribe_cov( &self, _subscriber_process_id: u32, _monitored_object_id: ObjectId, _issue_confirmed: bool, _lifetime: Option<u32>, ) -> Result<(), BacnetServiceError>

Called for a SubscribeCOV confirmed request.

The default implementation rejects with BacnetServiceError::UnknownObject.

Implementors§