Initial grpc generated code
parent
91cac82ba8
commit
2adcb4f516
|
@ -5,6 +5,15 @@ Turn the lights on!
|
|||
|
||||
## Developing
|
||||
|
||||
grpc-tools doesn't work on ARM, so developing on x86_64 GLIBC is required.
|
||||
|
||||
1. Get dependencies: `yarn install`
|
||||
2. Start server: `yarn start`
|
||||
|
||||
To generate gRPC files again, run `yarn generate`
|
||||
|
||||
## Running
|
||||
|
||||
```
|
||||
yarn install
|
||||
yarn start
|
||||
```
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
// GENERATED CODE -- DO NOT EDIT!
|
||||
|
||||
'use strict';
|
||||
var grpc = require('grpc');
|
||||
var framebuffer_pb = require('./framebuffer_pb.js');
|
||||
|
||||
function serialize_DrawResponse(arg) {
|
||||
if (!(arg instanceof framebuffer_pb.DrawResponse)) {
|
||||
throw new Error('Expected argument of type DrawResponse');
|
||||
}
|
||||
return Buffer.from(arg.serializeBinary());
|
||||
}
|
||||
|
||||
function deserialize_DrawResponse(buffer_arg) {
|
||||
return framebuffer_pb.DrawResponse.deserializeBinary(new Uint8Array(buffer_arg));
|
||||
}
|
||||
|
||||
function serialize_FrameBuffer(arg) {
|
||||
if (!(arg instanceof framebuffer_pb.FrameBuffer)) {
|
||||
throw new Error('Expected argument of type FrameBuffer');
|
||||
}
|
||||
return Buffer.from(arg.serializeBinary());
|
||||
}
|
||||
|
||||
function deserialize_FrameBuffer(buffer_arg) {
|
||||
return framebuffer_pb.FrameBuffer.deserializeBinary(new Uint8Array(buffer_arg));
|
||||
}
|
||||
|
||||
function serialize_FrameSequence(arg) {
|
||||
if (!(arg instanceof framebuffer_pb.FrameSequence)) {
|
||||
throw new Error('Expected argument of type FrameSequence');
|
||||
}
|
||||
return Buffer.from(arg.serializeBinary());
|
||||
}
|
||||
|
||||
function deserialize_FrameSequence(buffer_arg) {
|
||||
return framebuffer_pb.FrameSequence.deserializeBinary(new Uint8Array(buffer_arg));
|
||||
}
|
||||
|
||||
|
||||
var DrawerService = exports.DrawerService = {
|
||||
// DrawFrame draws one frame
|
||||
drawFrame: {
|
||||
path: '/Drawer/DrawFrame',
|
||||
requestStream: false,
|
||||
responseStream: false,
|
||||
requestType: framebuffer_pb.FrameBuffer,
|
||||
responseType: framebuffer_pb.DrawResponse,
|
||||
requestSerialize: serialize_FrameBuffer,
|
||||
requestDeserialize: deserialize_FrameBuffer,
|
||||
responseSerialize: serialize_DrawResponse,
|
||||
responseDeserialize: deserialize_DrawResponse,
|
||||
},
|
||||
// DrawFrames draws a series of frames
|
||||
drawFrames: {
|
||||
path: '/Drawer/DrawFrames',
|
||||
requestStream: false,
|
||||
responseStream: false,
|
||||
requestType: framebuffer_pb.FrameSequence,
|
||||
responseType: framebuffer_pb.DrawResponse,
|
||||
requestSerialize: serialize_FrameSequence,
|
||||
requestDeserialize: deserialize_FrameSequence,
|
||||
responseSerialize: serialize_DrawResponse,
|
||||
responseDeserialize: deserialize_DrawResponse,
|
||||
},
|
||||
};
|
||||
|
||||
exports.DrawerClient = grpc.makeGenericClientConstructor(DrawerService);
|
|
@ -7,9 +7,12 @@
|
|||
"license": "MPL-2.0",
|
||||
"scripts": {
|
||||
"generate": "yarn run generate-grpc",
|
||||
"generate-grpc": "protoc -I../../framebuffer ../../framebuffer/framebuffer.proto --js_out=import_style=commonjs,binary:framebuffer --grpc_out=framebuffer --plugin=protoc-gen-grpc=grpc_tools_node_protoc_plugin"
|
||||
"generate-grpc": "grpc_tools_node_protoc -I../../framebuffer ../../framebuffer/framebuffer.proto --js_out=import_style=commonjs,binary:framebuffer --grpc_out=framebuffer --plugin=protoc-gen-grpc=`which grpc_tools_node_protoc_plugin`"
|
||||
},
|
||||
"dependencies": {
|
||||
"grpc": "^1.19.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"grpc-tools": "^1.7.3"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue