mirror of
https://github.com/google/pebble.git
synced 2025-05-12 04:13:17 -04:00
71 lines
2.3 KiB
C
71 lines
2.3 KiB
C
// PULSE2 transport protocol event registry
|
|
|
|
#ifndef _PULSE2_TRANSPORT_PROTOCOL_NUMBERS_DEFINED
|
|
#define _PULSE2_TRANSPORT_PROTOCOL_NUMBERS_DEFINED
|
|
|
|
#define PULSE2_BEST_EFFORT_CONTROL_PROTOCOL (0xBA29)
|
|
#define PULSE2_BEST_EFFORT_TRANSPORT_PROTOCOL (0x3A29)
|
|
|
|
#define PULSE2_RELIABLE_CONTROL_PROTOCOL (0xBA33)
|
|
#define PULSE2_RELIABLE_TRANSPORT_COMMAND (0x3A33)
|
|
#define PULSE2_RELIABLE_TRANSPORT_RESPONSE (0x3A35)
|
|
|
|
#endif
|
|
|
|
// Available directives:
|
|
//
|
|
// ON_PACKET(number, packet_handler)
|
|
//
|
|
// number:
|
|
// The link-layer protocol number (uint16_t)
|
|
//
|
|
// packet_handler:
|
|
// Handler function for incoming packets.
|
|
// The handler function must have the signature
|
|
//
|
|
// void packet_handler(void *packet, size_t length);
|
|
//
|
|
// ON_INIT(initializer)
|
|
//
|
|
// initializer:
|
|
// Initializer function for the protocol. It will be called exactly once
|
|
// sometime before any of the handler functions are called. The function
|
|
// must have the signature
|
|
//
|
|
// void init(void);
|
|
//
|
|
// This argument may be NULL if no initialization is required.
|
|
//
|
|
// ON_LINK_STATE_CHANGE(link_layer_up_handler, link_layer_down_handler)
|
|
//
|
|
// link_layer_up_handler:
|
|
// Handler function for when the link layer comes up. It will be called
|
|
// when the link layer is ready to carry traffic.
|
|
//
|
|
// link_layer_down_handler:
|
|
// Handler function for when the link layer goes down. It will be called
|
|
// when the link layer is no longer available to carry traffic.
|
|
//
|
|
// Both handler functions must have the signature
|
|
//
|
|
// void link_state_handler(void);
|
|
|
|
ON_PACKET(PULSE2_BEST_EFFORT_CONTROL_PROTOCOL,
|
|
pulse2_best_effort_control_on_packet)
|
|
ON_PACKET(PULSE2_BEST_EFFORT_TRANSPORT_PROTOCOL,
|
|
pulse2_best_effort_transport_on_packet)
|
|
ON_INIT(pulse2_best_effort_init)
|
|
ON_LINK_STATE_CHANGE(pulse2_best_effort_on_link_up,
|
|
pulse2_best_effort_on_link_down)
|
|
|
|
ON_PACKET(PULSE2_RELIABLE_CONTROL_PROTOCOL,
|
|
pulse2_reliable_control_on_packet)
|
|
ON_PACKET(PULSE2_RELIABLE_TRANSPORT_COMMAND,
|
|
pulse2_reliable_transport_on_command_packet)
|
|
ON_PACKET(PULSE2_RELIABLE_TRANSPORT_RESPONSE,
|
|
pulse2_reliable_transport_on_response_packet)
|
|
ON_INIT(pulse2_reliable_init)
|
|
ON_LINK_STATE_CHANGE(pulse2_reliable_on_link_up,
|
|
pulse2_reliable_on_link_down)
|
|
|
|
// vim: filetype=c
|