Change-Id: I459f35fd943bc599c97a0dcec34c03c7885b555a
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
#define put_sff_id(buf, id) _put_id(buf, 2, id)
#define put_eff_id(buf, id) _put_id(buf, 7, id)
#define put_sff_id(buf, id) _put_id(buf, 2, id)
#define put_eff_id(buf, id) _put_id(buf, 7, id)
-static int canread_frame_parse(openxc_CanMessage *can_message, struct canfd_frame *canfd_frame, int maxdlen);
+static void canread_frame_parse(struct canfd_frame *canfd_frame, int maxdlen);
- canread_frame_parse(can_message, &canfd_frame, maxdlen);
+ canread_frame_parse(&canfd_frame, maxdlen);
}
/*
* Parse the CAN frame data payload as a CAN packet
* TODO: parse as an OpenXC Can Message
*/
}
/*
* Parse the CAN frame data payload as a CAN packet
* TODO: parse as an OpenXC Can Message
*/
-static int canread_frame_parse(openxc_CanMessage *can_message, struct canfd_frame *canfd_frame, int maxdlen)
+static void canread_frame_parse(struct canfd_frame *canfd_frame, int maxdlen)
{
int i,offset;
int len = (canfd_frame->len > maxdlen) ? maxdlen : canfd_frame->len;
{
int i,offset;
int len = (canfd_frame->len > maxdlen) ? maxdlen : canfd_frame->len;
if (canfd_frame->can_id & CAN_ERR_FLAG) {
put_eff_id(buf, canfd_frame->can_id & (CAN_ERR_MASK|CAN_ERR_FLAG));
if (canfd_frame->can_id & CAN_ERR_FLAG) {
put_eff_id(buf, canfd_frame->can_id & (CAN_ERR_MASK|CAN_ERR_FLAG));
buf[offset++] = hex_asc_upper[canfd_frame->len & 0xF];
buf[offset] = 0;
buf[offset++] = hex_asc_upper[canfd_frame->len & 0xF];
buf[offset] = 0;
}
if (maxdlen == CANFD_MAX_DLEN) {
/* add CAN FD specific escape char and flags */
buf[offset++] = '#';
buf[offset++] = hex_asc_upper[canfd_frame->flags & 0xF];
}
if (maxdlen == CANFD_MAX_DLEN) {
/* add CAN FD specific escape char and flags */
buf[offset++] = '#';
buf[offset++] = hex_asc_upper[canfd_frame->flags & 0xF];
- if (sep && len)
- buf[offset++] = '.';
for (i = 0; i < len; i++) {
put_hex_byte(buf + offset, canfd_frame->data[i]);
offset += 2;
for (i = 0; i < len; i++) {
put_hex_byte(buf + offset, canfd_frame->data[i]);
offset += 2;
- if (sep && (i+1 < len))
- buf[offset++] = '.';
can_message->id = msg.id; // TODO make the parsing to extract id from data and only return left data into msg.msg_iov
can_message->has_data = true;
can_message->data = msg.msg_iov;
can_message->id = msg.id; // TODO make the parsing to extract id from data and only return left data into msg.msg_iov
can_message->has_data = true;
can_message->data = msg.msg_iov;
}
/***************************************************************************************/
}
/***************************************************************************************/