All Downloads are FREE. Search and download functionalities are using the official Maven repository.

iozero-remote-common.1.4.1.source-code.diozero.proto Maven / Gradle / Ivy

The newest version!
syntax = "proto3";

package diozero;

import "google/protobuf/empty.proto";

option java_package = "com.diozero.remote.message.protobuf";
option java_multiple_files = true;
//option java_outer_classname = "DiozeroProtos";

service BoardService {
	rpc GetBoardInfo (google.protobuf.Empty) returns (Board.BoardInfoResponse) {}
	rpc SetBoardPwmFrequency (IntegerMessage) returns (Response) {}
	rpc SetBoardServoFrequency (IntegerMessage) returns (Response) {}
	rpc GetGpioMode (Gpio.Identifier) returns (Board.GpioModeResponse) {}
	rpc GetGpioValue (Gpio.Identifier) returns (IntegerResponse) {}
	rpc GetCpuTemperature (google.protobuf.Empty) returns (FloatResponse) {}
	rpc GetI2CBusNumbers (google.protobuf.Empty) returns (IntegerArrayResponse) {}
	rpc GetI2CFunctionalities (IntegerMessage) returns (IntegerResponse) {}
}

service GpioService {
	rpc ProvisionDigitalInputDevice (Gpio.ProvisionDigitalInputDeviceRequest) returns (Response) {}
	rpc ProvisionDigitalOutputDevice (Gpio.ProvisionDigitalOutputDeviceRequest) returns (Response) {}
	rpc ProvisionDigitalInputOutputDevice (Gpio.ProvisionDigitalInputOutputDeviceRequest) returns (Response) {}
	rpc ProvisionPwmOutputDevice (Gpio.ProvisionPwmOutputDeviceRequest) returns (Response) {}
	rpc ProvisionServoDevice (Gpio.ProvisionServoDeviceRequest) returns (Response) {}
	rpc ProvisionAnalogInputDevice (Gpio.ProvisionAnalogInputDeviceRequest) returns (Response) {}
	rpc ProvisionAnalogOutputDevice (Gpio.ProvisionAnalogOutputDeviceRequest) returns (Response) {}
	rpc DigitalRead (Gpio.Identifier) returns (BooleanResponse) {}
	rpc DigitalWrite (Gpio.BooleanMessage) returns (Response) {}
	rpc PwmRead (Gpio.Identifier) returns (FloatResponse) {}
	rpc PwmWrite (Gpio.FloatMessage) returns (Response) {}
	rpc ServoRead (Gpio.Identifier) returns (IntegerResponse) {}
	rpc ServoWrite (Gpio.IntegerMessage) returns (Response) {}
	rpc GetPwmFrequency (Gpio.Identifier) returns (IntegerResponse) {}
	rpc SetPwmFrequency (Gpio.IntegerMessage) returns (Response) {}
	rpc GetServoFrequency (Gpio.Identifier) returns (IntegerResponse) {}
	rpc SetServoFrequency (Gpio.IntegerMessage) returns (Response) {}
	rpc AnalogRead (Gpio.Identifier) returns (FloatResponse) {}
	rpc AnalogWrite (Gpio.FloatMessage) returns (Response) {}
	rpc SetOutput (Gpio.BooleanMessage) returns (Response) {}
	rpc Subscribe (Gpio.Identifier) returns (stream Gpio.Event) {}
	rpc Unsubscribe (Gpio.Identifier) returns (Response) {}
	rpc Close (Gpio.Identifier) returns (Response) {}
}

service I2CService {
	rpc Open (I2C.Open) returns (Response) {}
	rpc Probe (I2C.Probe) returns (BooleanResponse) {}
	rpc WriteQuick (I2C.Bit) returns (Response) {}
	rpc ReadByte (I2C.Identifier) returns (ByteResponse) {}
	rpc WriteByte (I2C.ByteMessage) returns (Response) {}
	rpc ReadByteData (I2C.Register) returns (ByteResponse) {}
	rpc WriteByteData (I2C.RegisterAndByte) returns (Response) {}
	rpc ReadWordData (I2C.Register) returns (WordResponse) {}
	rpc WriteWordData (I2C.RegisterAndWordData) returns (Response) {}
	rpc ProcessCall (I2C.RegisterAndWordData) returns (WordResponse) {}
	rpc ReadBlockData (I2C.Register) returns (I2C.ByteArrayWithLengthResponse) {}
	rpc WriteBlockData (I2C.RegisterAndByteArray) returns (Response) {}
	rpc BlockProcessCall (I2C.RegisterAndByteArray) returns (BytesResponse) {}
	rpc ReadI2CBlockData (I2C.RegisterAndNumBytes) returns (BytesResponse) {}
	rpc WriteI2CBlockData (I2C.RegisterAndByteArray) returns (Response) {}
	rpc ReadBytes (I2C.NumBytes) returns (BytesResponse) {}
	rpc WriteBytes (I2C.ByteArray) returns (Response) {}
	rpc ReadWrite (I2C.ReadWrite) returns (BytesResponse) {}
	rpc Close (I2C.Identifier) returns (Response) {}
}

service SPIService {
	rpc Open (SPI.Open) returns (Response) {}
	rpc Write (SPI.ByteArray) returns (Response) {}
	rpc WriteAndRead (SPI.ByteArray) returns (BytesResponse) {}
	rpc Close (SPI.Identifier) returns (Response) {}
}

service SerialService {
	rpc Open (Serial.Open) returns (Response) {}
	rpc Read (Serial.Identifier) returns (IntegerResponse) {}
	rpc ReadByte (Serial.Identifier) returns (ByteResponse) {}
	rpc WriteByte (Serial.ByteMessage) returns (Response) {}
	rpc ReadBytes (Serial.NumBytes) returns (BytesResponse) {}
	rpc WriteBytes (Serial.ByteArray) returns (Response) {}
	rpc BytesAvailable (Serial.Identifier) returns (IntegerResponse) {}
	rpc Close (Serial.Identifier) returns (Response) {}
}

enum Status {
	OK = 0;
	ERROR = 1;
}

message IntegerMessage {
	int32 value = 1;
}

// Response messages

message Response {
	Status status = 1;
	string detail = 2;
}

message BooleanResponse {
	Status status = 1;
	string detail = 2;
	bool data = 3;
}

// Note protobuf doesn't have a byte data type, used to track when a value should be a byte
message ByteResponse {
	Status status = 1;
	string detail = 2;
	int32 data = 3;
}

// Note protobuf doesn't have a short/word data type, used to track when a value should be a short/word
message WordResponse {
	Status status = 1;
	string detail = 2;
	int32 data = 3;
}

message IntegerResponse {
	Status status = 1;
	string detail = 2;
	int32 data = 3;
}

message IntegerArrayResponse {
	Status status = 1;
	string detail = 2;
	repeated int32 data = 3;
}

message FloatResponse {
	Status status = 1;
	string detail = 2;
	float data = 3;
}

message BytesResponse {
	Status status = 1;
	string detail = 2;
	bytes data = 3;
}

message Board {
	enum GpioMode {
		DIGITAL_INPUT = 0;
		DIGITAL_OUTPUT = 1;
		PWM_OUTPUT = 2;
		ANALOG_INPUT = 3;
		ANALOG_OUTPUT = 4;
		SERVO = 5;
		UNKNOWN = 6;
	}

	message GpioInfo {
		string header = 1;
		int32 physicalPin = 2;
		int32 gpioNumber = 3;
		int32 sysFsNumber = 4;
		int32 chip = 5;
		int32 lineOffset = 6;
		string name = 7;
		repeated GpioMode mode = 8;
		optional int32 pwmChip = 9;
		optional int32 pwmNum = 10;
		optional float adcVRef = 11;
	}

	message HeaderInfo {
		string name = 1;
		repeated GpioInfo gpio = 2;
	}

	message BoardInfoResponse {
		Status status = 1;
		string detail = 2;
		string make = 3;
		string model = 4;
		int32 memory = 5;
		repeated HeaderInfo header = 6;
		int32 boardPwmFrequency = 7;
		int32 boardServoFrequency = 8;
		int32 spiBufferSize = 9;
		string osId = 10;
		string osVersion = 11;
		bool biasControlSupported = 12;
		bool recognised = 13;
	}

	message GpioModeResponse {
		Status status = 1;
		string detail = 2;
		GpioMode mode = 3;
	}
}

message Gpio {
	enum PullUpDown {
		PUD_NONE = 0;
		PUD_PULL_UP = 1;
		PUD_PULL_DOWN = 2;
	}

	enum Trigger {
		TRIGGER_NONE = 0;
		TRIGGER_RISING = 1;
		TRIGGER_FALLING = 2;
		TRIGGER_BOTH = 3;
	}

	message Identifier {
		int32 gpio = 1;
	}

	message ProvisionDigitalInputDeviceRequest {
		int32 gpio = 1;
		PullUpDown pud = 2;
		Trigger trigger = 3;
	}

	message ProvisionDigitalOutputDeviceRequest {
		int32 gpio = 1;
		bool initialValue = 2;
	}

	message ProvisionDigitalInputOutputDeviceRequest {
		int32 gpio = 1;
		bool output = 2;
	}

	message ProvisionPwmOutputDeviceRequest {
		int32 gpio = 1;
		int32 frequency = 2;
		float initialValue = 3;
	}

	message ProvisionServoDeviceRequest {
		int32 gpio = 1;
		int32 frequency = 2;
		int32 minPulseWidthUs = 3;
		int32 maxPulseWidthUs = 4;
		int32 initialPulseWidthUs = 5;
	}

	message ProvisionAnalogInputDeviceRequest {
		int32 gpio = 1;
	}

	message ProvisionAnalogOutputDeviceRequest {
		int32 gpio = 1;
		float initialValue = 2;
	}

	message BooleanMessage {
		int32 gpio = 1;
		bool value = 2;
	}

	message FloatMessage {
		int32 gpio = 1;
		float value = 2;
	}

	message IntegerMessage {
		int32 gpio = 1;
		int32 value = 2;
	}

	message Event {
		int32 gpio = 1;
		optional int64 epochTime = 2;
		optional int64 nanoTime = 3;
		optional bool value = 4;
		optional Status status = 5;
		optional string detail = 6;
	}
}

message I2C {
	enum ProbeMode {
		QUICK = 0;
		READ = 1;
		AUTO = 2;
	}

	message Identifier {
		int32 controller = 1;
		int32 address = 2;
	}

	message Open {
		int32 controller = 1;
		int32 address = 2;
		int32 addressSize = 3;
	}

	message Probe {
		int32 controller = 1;
		int32 address = 2;
		ProbeMode probeMode = 3;
	}

	message Bit {
		int32 controller = 1;
		int32 address = 2;
		int32 bit = 3;
	}

	message ByteMessage {
		int32 controller = 1;
		int32 address = 2;
		int32 data = 3;
	}

	message Register {
		int32 controller = 1;
		int32 address = 2;
		int32 register = 3;
	}

	message RegisterAndByte {
		int32 controller = 1;
		int32 address = 2;
		int32 register = 3;
		int32 data = 4;
	}

	message RegisterAndWordData {
		int32 controller = 1;
		int32 address = 2;
		int32 register = 3;
		int32 data = 4;
	}

	message RegisterAndByteArray {
		int32 controller = 1;
		int32 address = 2;
		int32 register = 3;
		bytes data = 4;
	}

	message RegisterAndNumBytes {
		int32 controller = 1;
		int32 address = 2;
		int32 register = 3;
		int32 length = 4;
	}

	message NumBytes {
		int32 controller = 1;
		int32 address = 2;
		int32 length = 3;
	}

	message ByteArray {
		int32 controller = 1;
		int32 address = 2;
		bytes data = 3;
	}

	message I2CMessage {
		int32 flags = 1;
		int32 len = 2;
	}

	message ReadWrite {
		int32 controller = 1;
		int32 address = 2;
		repeated I2CMessage message = 3;
		bytes data = 4;
	}

	// I2C Responses

	message ByteArrayWithLengthResponse {
		Status status = 1;
		string detail = 2;
		int32 bytesRead = 3;
		bytes data = 4;
	}
}

message SPI {
	enum ClockMode {
		MODE_0 = 0;
		MODE_1 = 1;
		MODE_2 = 2;
		MODE_3 = 3;
	}

	message Identifier {
		int32 controller = 1;
		int32 chipSelect = 2;
	}

	message Open {
		int32 controller = 1;
		int32 chipSelect = 2;
		int32 frequency = 3;
		ClockMode clockMode = 5;
		bool lsbFirst = 6;
	}

	message ByteArray {
		int32 controller = 1;
		int32 chipSelect = 2;
		bytes txData = 3;
	}
}

message Serial {
	message Identifier {
		string deviceFile = 1;
	}

	message Open {
		string deviceFile = 1;
		int32 baud = 2;
		int32 dataBits = 3;
		int32 stopBits = 4;
		int32 parity = 5;
		bool readBlocking = 6;
		int32 minReadChars = 7;
		int32 readTimeoutMillis = 8;
	}

	message ByteMessage {
		string deviceFile = 1;
		int32 value = 2;
	}

	message ByteArray {
		string deviceFile = 1;
		bytes data = 2;
	}

	message NumBytes {
		string deviceFile = 1;
		int32 length = 2;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy