static void factory_receive_skb(struct sk_buff *skb) { struct nlmsghdr *nlh; int len; int err; nlh = (struct nlmsghdr*)skb->data; len = skb->len; while (NLMSG_OK(nlh, len)) { err = process_received_msg(skb, nlh); /* if err or if this message says it wants a response */ if (err || (nlh->nlmsg_flags & NLM_F_ACK)) netlink_ack(skb, nlh, err); nlh = NLMSG_NEXT(nlh, len); } }
bool vesc_get_values(mc_values& values) { uint8_t command[1] = { COMM_GET_VALUES }; uint8_t payload[256]; send_payload(command, 1); delay(20); //needed, otherwise data is not read int lenPayload = process_received_msg(payload); if (lenPayload > 0) { bool read = process_read_package(payload, values, lenPayload); //returns true if sucessfull return read; } else { return false; } }