#serial-communication #bill-acceptor #serial #bill-validator

no-std ebds

Messages and related types for implementing the EBDS serial communication protocol

9 unstable releases (3 breaking)

0.4.1 Aug 18, 2023
0.4.0 Aug 18, 2023
0.3.0 Aug 17, 2023
0.2.1 Aug 10, 2023
0.1.2 May 30, 2023

#67 in No standard library

Download history 4/week @ 2024-02-16 9/week @ 2024-02-23 4/week @ 2024-03-01 21/week @ 2024-03-08 2/week @ 2024-03-15 48/week @ 2024-03-29 10/week @ 2024-04-05

58 downloads per month

MIT license

475KB
10K SLoC

EBDS Serial Protocol

This crate implements the EBDS serial protocol messages, and related types for communication with bill acceptor unit devices.

The currently supported messages are implemented in the various modules in this crate, along with some common types used across multiple messages.

If adding a new message, please follow the existing pattern of placing ...Command (host-initiated) messages in <message-type>/command.rs files, and ...Reply (device-initiated) messages in <message-type>/reply.rs files.

There are some exceptions to the general rule, e.g. when the types in the documenation do not follow the Command/Reply naming convention.

In those cases, the suffix is omitted to aid in readability when comparing with the EBDS specification.

Macros

Some simple macros exist for implementing traits over the various message types. All message types should implement MessageOps, and all reply types should implement OmnibusReplyOps.

MessageOps can be implemented with the helper macro impl_message_ops!, e.g. for a new SomeNewReply message:

use crate::impl_message_ops;

pub struct SomeNewReply {
    // For the example, we are just using a number for the length.
    // In real implementations, please add a constant to the `len` module.
    buf: [u8; 11],
}

impl_message_ops!(SomeNewReply);

This will implement the MessageOps trait for SomeNewReply, and provide all of the associated functions. Traits are how Rust does polymorphism, similar to Go's interface and C++'s template, with important differences.

All of the macro implementations live in src/macros.rs.

Using with std

This library is no-std compatible by default. To use std-only features, add the std feature to the dependency:

ebds = { version = "0.1", features = ["std"] }

Dependencies

~2.4–4MB
~84K SLoC