BusBricks: ErrorService Class Reference
BusBricks  0.1
Customize bus-communication
Loading...
Searching...
No Matches
ErrorService Class Reference

Service class for handling Errors. More...

Inheritance diagram for ErrorService:
[legend]
Collaboration diagram for ErrorService:
[legend]

Public Member Functions

 ErrorService (uint8_t instance_id)
 Constructor for ErrorService with default Service ID "m".
 
 ErrorService (uint8_t instance_id, uint8_t service_id)
 Constructor for ErrorService with a custom Service ID.
 
void raiseError (errorCodes code)
 Adds an Error-object for the local Instance-Id to the Error-services rec-stack.
 
void stackProcessing () override
 Processes all errors from the receive stack.
 
- Public Member Functions inherited from Service< Error, STACKSIZE >
 Service (uint8_t serviceID, uint8_t instanceID)
 
uint8_t * get_ServiceID () override
 Get pointer to the 1-byte ServiceID of the Service (unique for each Service-template derived Class)
 
uint8_t * get_InstanceID () override
 Get pointer to the 1-byte InstanceID of the Service-instance (unique for each Instance of Service within the whole communication-network)
 
virtual bool impart_pdu (String *pdu) override
 Add a new Content-Object created from a received payload to the services receive-Stack. The payload is the representation of the Content-Object, during the construction, the Content-object creates it's content from the representation. The Content-object is added to the rec_stack.
 
virtual String get_response () override
 Get the get the response-payload, stored at the response_pdu of the service instance

 
virtual bool responseAvailable () override
 Check, if a response of the service is available (services sendStack not empty)
 
virtual void clearResponse () override
 Clear the response-buffer (delete item, that was returned by get_response from the service-sendStack)
 
- Public Member Functions inherited from ServiceBase
virtual bool impart_pdu (String *pdu)=0
 Add a new Content-Object created from a received payload to the services receive-Stack. The payload is the representation of the Content-Object, during the construction, the Content-object creates it's content from the representation. The Content-object is added to the rec_stack.
 
virtual ~ServiceBase ()
 Destroy the Service Base object.
 

Additional Inherited Members

- Protected Member Functions inherited from Service< Error, STACKSIZE >
void write_response_pdu (Error response_object)
 
- Protected Attributes inherited from Service< Error, STACKSIZE >
uint8_t serviceID
 
uint8_t instanceID
 
Content_stack< Error, stackSize > rec_stack
 
Content_stack< Error, stackSize > send_stack
 
String response_pdu
 

Detailed Description

Service class for handling Errors.

The ErrorService class manages content from type 'Error', processes incoming errors from the receive stack, and handles sending errors. It inherits from a Service for content_type 'Error' (Service<Error, STACKSIZE>). Errors occurred internally are raised by calling the raiseError-function of the service. Those Errors are added with the local instanceId to the recStack. During the processing, errors with the local instanceId are putted back to the sendStack to publish them to the network. All Errors are printed to the Serial-interface.

Constructors

Methods

  • void stackProcessing() override: Processes all errors from the receive stack until it is empty. Adds error-responds to the send stack and prints received errors.
  • void raiseError(errorCodes code): add an Error occurred internally to the receive-stack
  • void printError(Error* error): Prints the content of an error
Note
  • The class handles both the processing of incoming errors and the sending of internally occurred errors.
  • The stackProcessing method is responsible for managing the receive and send stacks.

Constructor & Destructor Documentation

◆ ErrorService() [1/2]

ErrorService::ErrorService ( uint8_t instance_id)

Constructor for ErrorService with default Service ID "m".

Initializes the service with the given instance ID and a default service ID.

Parameters
instance_idThe instance ID for the service.

◆ ErrorService() [2/2]

ErrorService::ErrorService ( uint8_t instance_id,
uint8_t service_id )

Constructor for ErrorService with a custom Service ID.

Initializes the service with the given instance ID and a custom service ID.

Parameters
instance_idThe instance ID for the service.
service_idThe custom service ID.

Member Function Documentation

◆ raiseError()

void ErrorService::raiseError ( errorCodes code)

Adds an Error-object for the local Instance-Id to the Error-services rec-stack.

Adds an Error-object for the local Instance-Id and given error-code to the Error-services rec-stack.

Parameters
codeThe error code of the error to be raised.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ stackProcessing()

void ErrorService::stackProcessing ( )
overridevirtual

Processes all errors from the receive stack.

Processes each error in the receive stack until it is empty. Each received error is printed to the serial output, generates and adds an acknowledgment PDU to the send stack, and removes the processed message from the receive stack.

Processes each error in the receive stack until it is empty. Each received error is printed to the serial output. If the Instance-ID of a received Error is the Instance-ID of the Service, the Error-representation is put to the send-stack to be broadcasted.

Reimplemented from Service< Error, STACKSIZE >.

Here is the call graph for this function:

The documentation for this class was generated from the following files: