syntax = "proto3"; package meshtastic; option csharp_namespace = "Meshtastic.Protobufs"; option go_package = "github.com/meshtastic/go/generated"; option java_outer_classname = "SerialHal"; option java_package = "org.meshtastic.proto"; option swift_prefix = ""; // SerialHalCommand messages are sent from host to device over the SerialHal // framing stream. Responses normally come back as SerialHalResponse with the // same transaction_id. // // Interrupt notifications are the one asynchronous exception: the device emits // an unsolicited SerialHalResponse with transaction_id == 0 and value == pin. // Host implementations should treat those frames as interrupt events rather // than replies to an outstanding request. message SerialHalCommand { enum Type { UNSET = 0; PIN_MODE = 1; DIGITAL_WRITE = 2; DIGITAL_READ = 3; ATTACH_INTERRUPT = 4; DETACH_INTERRUPT = 5; SPI_TRANSFER = 6; NOOP = 7; } // Host-assigned request id. Replies echo this id back in // SerialHalResponse.transaction_id. uint32 transaction_id = 1; Type type = 2; uint32 pin = 3; uint32 value = 4; uint32 mode = 5; bytes data = 6; } message SerialHalResponse { enum Result { OK = 0; ERROR = 1; BAD_REQUEST = 2; UNSUPPORTED = 3; } // Matches the originating SerialHalCommand.transaction_id for normal // request/response traffic. // // A value of 0 indicates an unsolicited interrupt notification generated by // the device. In that case, the host should interpret value as the GPIO pin // that triggered. uint32 transaction_id = 1; Result result = 2; // Used by DIGITAL_READ replies and interrupt notifications. For interrupt // notifications (transaction_id == 0), this carries the pin number. uint32 value = 3; bytes data = 4; string error = 5; }