Handlers of inbound messages, one per endpoint ID.
More...
|
| #define | PBL_PP_ENDPOINT_DEFINE(_id, _access, _handler) PBL_PP__ENDPOINT_DEFINE(_id, _access, _handler, NULL, PBL_PP_HANDLER_BG) |
| | Define an endpoint whose handler runs on KernelBG.
|
| |
| #define | PBL_PP_ENDPOINT_DEFINE_MAIN(_id, _access, _handler) PBL_PP__ENDPOINT_DEFINE(_id, _access, _handler, NULL, PBL_PP_HANDLER_MAIN) |
| | Define an endpoint whose handler runs on KernelMain.
|
| |
| #define | PBL_PP_ENDPOINT_DEFINE_RECEIVER(_id, _access, _receiver) PBL_PP__ENDPOINT_DEFINE(_id, _access, NULL, &(_receiver), PBL_PP_HANDLER_BG) |
| | Define an endpoint with its own receiver.
|
| |
|
| typedef void(* | pbl_pp_endpoint_handler_t) (struct pbl_pp_session *session, const uint8_t *data, size_t length) |
| | Endpoint handler.
|
| |
Handlers of inbound messages, one per endpoint ID.
An endpoint is defined next to the code that handles it and collected at link time:
static void prv_ping_handler(struct pbl_pp_session *session, const uint8_t *data,
size_t length) {
...
}
#define PBL_PP_ENDPOINT_DEFINE(_id, _access, _handler)
Define an endpoint whose handler runs on KernelBG.
Definition endpoint.h:175
@ PBL_PP_ACCESS_ANY
Anyone.
Definition endpoint.h:49
#define PBL_PP_ENDPOINT_PING
Definition protocol.h:54
The handler runs on KernelBG once the whole message has arrived, with a copy of the payload on the kernel heap. PBL_PP_ENDPOINT_DEFINE_MAIN() runs it on KernelMain instead, for handlers whose events must stay ordered with the session events. Endpoints that need their own buffering provide a pbl_pp_receiver_api with PBL_PP_ENDPOINT_DEFINE_RECEIVER().
◆ pbl_pp_endpoint
◆ PBL_PP_ENDPOINT_DEFINE
| #define PBL_PP_ENDPOINT_DEFINE |
( |
|
_id, |
|
|
|
_access, |
|
|
|
_handler |
|
) |
| PBL_PP__ENDPOINT_DEFINE(_id, _access, _handler, NULL, PBL_PP_HANDLER_BG) |
Define an endpoint whose handler runs on KernelBG.
- Parameters
-
◆ PBL_PP_ENDPOINT_DEFINE_MAIN
| #define PBL_PP_ENDPOINT_DEFINE_MAIN |
( |
|
_id, |
|
|
|
_access, |
|
|
|
_handler |
|
) |
| PBL_PP__ENDPOINT_DEFINE(_id, _access, _handler, NULL, PBL_PP_HANDLER_MAIN) |
Define an endpoint whose handler runs on KernelMain.
- Parameters
-
◆ PBL_PP_ENDPOINT_DEFINE_RECEIVER
| #define PBL_PP_ENDPOINT_DEFINE_RECEIVER |
( |
|
_id, |
|
|
|
_access, |
|
|
|
_receiver |
|
) |
| PBL_PP__ENDPOINT_DEFINE(_id, _access, NULL, &(_receiver), PBL_PP_HANDLER_BG) |
Define an endpoint with its own receiver.
- Parameters
-
◆ pbl_pp_endpoint_handler_t
| typedef void(* pbl_pp_endpoint_handler_t) (struct pbl_pp_session *session, const uint8_t *data, size_t length) |
Endpoint handler.
- Parameters
-
| session | Session the message arrived on. |
| data | Message payload. |
| length | Length of data in bytes. |
◆ pbl_pp_access
Who may send messages to an endpoint.
| Enumerator |
|---|
| PBL_PP_ACCESS_NONE | No one.
|
| PBL_PP_ACCESS_PUBLIC | Third party phone apps.
|
| PBL_PP_ACCESS_PRIVATE | The Pebble mobile app.
|
| PBL_PP_ACCESS_ANY | Anyone.
|
◆ pbl_pp_handler_task
Task the default receiver runs an endpoint handler on.
| Enumerator |
|---|
| PBL_PP_HANDLER_BG | KernelBG.
|
| PBL_PP_HANDLER_MAIN | KernelMain.
|
◆ pbl_pp_kernel_receiver
The default receiver.
Copies the payload to the kernel heap and runs the endpoint's handler on the endpoint's task. Receivers that hand some messages over to a handler can delegate to it.