X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fnet%2Fax25.h;h=da56b28b5c1b9e30aecd1109c3fb0d41e554483c;hb=86abd5b97ebd9132d0d62b59374be037f98771ae;hp=1db21fa7dac9685204f65f87a6181b475afec1ce;hpb=0f7e0ff6fdd1cf33240751ebd6eed7b34fe23b82;p=bertos.git diff --git a/bertos/net/ax25.h b/bertos/net/ax25.h index 1db21fa7..da56b28b 100644 --- a/bertos/net/ax25.h +++ b/bertos/net/ax25.h @@ -95,6 +95,13 @@ typedef struct AX25Call uint8_t ssid; ///< SSID (secondary station ID) for the call } AX25Call; +/** + * Create an AX25Call structure on the fly and return its pointer. + * \param str callsign, can be 6 characters or shorter. + * \param id ssid associated with the callsign. + */ +#define AX25_CALL(str, id) ({ static const AX25Call _call = { .call = (str), .ssid = (id) }; &_call; }) + /** * Maximum number of Repeaters in a AX25 message. */ @@ -115,7 +122,7 @@ typedef struct AX25Msg #endif uint16_t ctrl; ///< AX25 control field uint8_t pid; ///< AX25 PID field - uint8_t *info; ///< Pointer to the info field (payload) of the message + const uint8_t *info; ///< Pointer to the info field (payload) of the message size_t len; ///< Payload length } AX25Msg; @@ -123,7 +130,7 @@ typedef struct AX25Msg #define AX25_PID_NOLAYER3 0xF0 /** - * HDLC flags + * \name HDLC flags. * These should be moved in * a separated HDLC related file one day... * \{ @@ -134,25 +141,9 @@ typedef struct AX25Msg /* \} */ -/** - * Check if there are any AX25 messages to be processed. - * This function read available characters from the medium and search for - * any AX25 messages. - * If a message is found it is decoded and the linked callback executed. - * This function may be blocking if there are no available chars and the KFile - * used in \a ctx to access the medium is configured in blocking mode. - * - * \param ctx AX25 context to operate on. - */ -void ax25_poll(AX25Ctx *ctx); -/** - * Init the AX25 protocol decoder. - * - * \param ctx AX25 context to init. - * \param channel Used to gain access to the physical medium - * \param hook Callback function called when a message is received - */ +void ax25_poll(AX25Ctx *ctx); +void ax25_send(AX25Ctx *ctx, const AX25Call *dst, const AX25Call *src, const void *_buf, size_t len); void ax25_init(AX25Ctx *ctx, KFile *channel, ax25_callback_t hook); int ax25_testSetup(void);