BeRTOS
Defines | Functions
keytag.c File Reference

KeyTAG parser. More...

#include "keytag.h"
#include <cfg/debug.h>
#include <cfg/log.h>
#include <cfg/macros.h>
#include <io/kfile.h>
#include <string.h>

Go to the source code of this file.

Defines

#define TAG_STX   0x02
 Starting communication char (STX).
#define TAG_ETX   0x03
 Ending communication char (ETX).

Functions

void keytag_poll (struct TagPacket *pkt)
 DEPRECATED FUCNTIONS To read the tag string from device you shoul use the keytag_recv fuction, that return the string if we had received it.
int keytag_recv (struct TagPacket *pkt, uint8_t *tag, size_t len)
 Receive the tag message from channel, and if the tag is good put the converted string into given buffer.
void keytag_init (struct TagPacket *pkt, struct KFile *comm, struct KFile *tag)
 Init the keytag module.

Detailed Description

KeyTAG parser.

Author:
Andrea Grandi <andrea@develer.com>
Daniele Basile <asterix@develer.com>

This module parse TAG message that come from comunication channel, and convert the tag value into string.

TAG protocol is decribed in this way:

 ---------------------------------------------------
 |STX (0x02)|data...(10 HEX chars)|CR|LF|ETX (0x03)|
 ---------------------------------------------------
 

Definition in file keytag.c.


Function Documentation

int keytag_recv ( struct TagPacket pkt,
uint8_t *  tag,
size_t  len 
)

Receive the tag message from channel, and if the tag is good put the converted string into given buffer.

The fuction return the len of found tag string, otherwise EOF.

Definition at line 95 of file keytag.c.