Common Service Patterns

Many services provide the same common IPC functionality.

See also the IPC framework Subscriptions.

Resources

The following messages are common for system resources (e.g. Cellular Data).

Request and Release

The request messages (<resource>_request_req/rsp) are used to request access to a resource. If at least one user requests a resource, it will be activated (e.g. start GNSS receiver). This implies that an application that has subscribed to messages from a resource may receive its published messages even if the application itself has not requested the resource yet.

A resource may need several seconds (sometimes up to a minute) to perform its startup actions once requested. This is typically the case for the Location and Cellular services.

The release message (<resource>_release_req_norsp) is used to tell the resource that given user is not interested in it anymore. If a resource has no users, it will be deactivated.

Warning

A resource request is persistent over IPC sessions. That means that a resource will not be automatically released when a user application exits.

hide footbox
skinparam ParticipantPadding 50
skinparam BoxPadding 10

participant "User" as UserCode
participant "service" as Service

group Request
UserCode -> Service : foo_request_req
Service -> UserCode : foo_request_rsp
end

group Release
UserCode -> Service : foo_release_req_norsp
end

Status

The status message provides general information about the service.

hide footbox
skinparam ParticipantPadding 50
skinparam BoxPadding 10

participant "User" as UserCode
participant "service" as Service

UserCode -> Service : foo_status_req
Service -> UserCode : foo_status_rsp