From 3491477dcadfc70dcc774c31dfd03317e77378b1 Mon Sep 17 00:00:00 2001 From: Kotlin Developer Date: Sun, 5 Jun 2016 23:18:46 +0000 Subject: [PATCH] Few first files. --- proto/carkot.proto | 28 ++++++++++++++++++++++++++++ proxy/proxy.js | 10 ++++++++++ 2 files changed, 38 insertions(+) create mode 100644 proto/carkot.proto create mode 100644 proxy/proxy.js diff --git a/proto/carkot.proto b/proto/carkot.proto new file mode 100644 index 00000000000..81c416ee3ac --- /dev/null +++ b/proto/carkot.proto @@ -0,0 +1,28 @@ +message Upload { + message Method { + enum TYPE { + DFU = 1; + } + // Type of upload method. + optional TYPE type = 1; + // Upload port. + optional string port = 2; + // Device address, smth like 8087:0ABA. + optional string device = 3; + // Additional programmator-specific arguments. + repeated string arguments = 4; + } + // Firmware data. + optional bytes data = 1; + // Method of firmware upload. + optional Method method = 2; +} + +message UploadResult { + optional string error = 1; +} + +message LogMessage { + optional string source = 1; + optional bytes message = 2; +} diff --git a/proxy/proxy.js b/proxy/proxy.js new file mode 100644 index 00000000000..31c3db5f57d --- /dev/null +++ b/proxy/proxy.js @@ -0,0 +1,10 @@ +var protobuf = require('protocol-buffers') +var fs = require('fs') + +var messages = protobuf(fs.readFileSync(__dirname + '/../proto/carkot.proto')) + +var ex = { + data: '12345' +} + +var buf = messages.Upload.encode(ex)