Added bootstrap script and fixed message writing
This commit is contained in:
parent
98e3df4b2e
commit
84c4060c9f
|
|
@ -0,0 +1,15 @@
|
|||
#!/bin/sh
|
||||
|
||||
git submodule update --init --recursive
|
||||
|
||||
sh proto_gen.sh
|
||||
|
||||
# create the program directories:
|
||||
# ./build will be the executable is compiled
|
||||
# ./data will contain the user files
|
||||
mkdir build data
|
||||
# run cmake
|
||||
cd build
|
||||
cmake ../src -DDETACH_KERNEL_DRIVER=ON
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
cd src/external/PiScan-protobuf
|
||||
|
||||
protoc -I=. --cpp_out=. *.proto
|
||||
|
||||
cd ../../..
|
||||
|
|
@ -9,7 +9,7 @@ set(CMAKE_BUILD_TYPE Debug)
|
|||
add_executable(piScan_backend piScan_backend.cpp)
|
||||
|
||||
|
||||
include_directories(core drivers external scan server sigproc external/PiScan-protobuf/cpp)
|
||||
include_directories(core drivers external scan server sigproc external/PiScan-protobuf)
|
||||
|
||||
add_subdirectory(core)
|
||||
add_subdirectory(drivers)
|
||||
|
|
|
|||
|
|
@ -8,17 +8,17 @@ add_library(external
|
|||
convenience.c
|
||||
)
|
||||
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/PiScan-protobuf/cpp)
|
||||
target_include_directories(external PUBLIC PiScan-protobuf/cpp)
|
||||
target_include_directories(piScan_backend PUBLIC PiScan-protobuf/cpp)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/PiScan-protobuf)
|
||||
target_include_directories(external PUBLIC PiScan-protobuf)
|
||||
target_include_directories(piScan_backend PUBLIC PiScan-protobuf)
|
||||
|
||||
target_sources(external PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/PiScan-protobuf/cpp/context.pb.cc
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/PiScan-protobuf/cpp/context.pb.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/PiScan-protobuf/cpp/messages.pb.cc
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/PiScan-protobuf/cpp/messages.pb.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/PiScan-protobuf/cpp/request.pb.cc
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/PiScan-protobuf/cpp/request.pb.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/PiScan-protobuf/context.pb.cc
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/PiScan-protobuf/context.pb.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/PiScan-protobuf/messages.pb.cc
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/PiScan-protobuf/messages.pb.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/PiScan-protobuf/request.pb.cc
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/PiScan-protobuf/request.pb.h
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 16a4f2dfc4fb0eb969428c0c202b9b90464c807c
|
||||
Subproject commit c65310f96340382fcbc2319a4820ff1258fec946
|
||||
|
|
@ -59,7 +59,7 @@ void SocketConnection::contextUpdate(ScannerContext context){
|
|||
msg.set_allocated_scannercontext(ctx);
|
||||
|
||||
msg.SerializeToArray(_writeBuffer, WRITE_BUFFER_LENGTH);
|
||||
_startWrite(_writeBuffer, WRITE_BUFFER_LENGTH);
|
||||
_startWrite(_writeBuffer, msg.ByteSize());
|
||||
}
|
||||
|
||||
void SocketConnection::contextUpdate(DemodContext context){
|
||||
|
|
@ -73,7 +73,7 @@ void SocketConnection::contextUpdate(DemodContext context){
|
|||
msg.set_allocated_demodcontext(ctx);
|
||||
|
||||
msg.SerializeToArray(_writeBuffer, WRITE_BUFFER_LENGTH);
|
||||
_startWrite(_writeBuffer, WRITE_BUFFER_LENGTH);
|
||||
_startWrite(_writeBuffer, msg.ByteSize());
|
||||
}
|
||||
|
||||
void SocketConnection::systemMessage(GeneralMessage message) {
|
||||
|
|
@ -101,7 +101,7 @@ void SocketConnection::systemMessage(GeneralMessage message) {
|
|||
msg.set_allocated_generalmessage(ctx);
|
||||
|
||||
msg.SerializeToArray(_writeBuffer, WRITE_BUFFER_LENGTH);
|
||||
_startWrite(_writeBuffer, WRITE_BUFFER_LENGTH);
|
||||
_startWrite(_writeBuffer, msg.ByteSize());
|
||||
}
|
||||
|
||||
void SocketConnection::_startRead() {
|
||||
|
|
@ -125,19 +125,14 @@ void SocketConnection::_handleRead(const boost::system::error_code& err,
|
|||
piscan_pb::ClientToServer msg;
|
||||
msg.ParseFromArray(_readBuffer, bytes_transferred);
|
||||
|
||||
std::cerr << msg.DebugString();
|
||||
|
||||
switch(msg.type()){
|
||||
case piscan_pb::ClientToServer_Type_GENERAL_REQUEST:
|
||||
std::cerr << "general" << std::endl;
|
||||
_handleGeneralRequest(msg.generalrequest());
|
||||
break;
|
||||
case piscan_pb::ClientToServer_Type_SCANNER_STATE_REQUEST:
|
||||
std::cerr << "scanner" << std::endl;
|
||||
_handleScanStateRequest(msg.scanstaterequest());
|
||||
break;
|
||||
case piscan_pb::ClientToServer_Type_DEMOD_REQUEST:
|
||||
std::cerr << "demod" << std::endl;
|
||||
_handleDemodRequest(msg.demodrequest());
|
||||
break;
|
||||
default:
|
||||
|
|
|
|||
Loading…
Reference in New Issue