瀏覽代碼

fix(grpc_BS):fix shm creat error

孙嘉城 3 年之前
父節點
當前提交
63bf14314e

+ 5 - 2
src/driver/driver_cloud_grpc_client_BS/vehicle_control.cpp

@@ -34,6 +34,11 @@ using org::jeecg::defsControl::grpc::ShiftStatus;
 VehicleControlClient::VehicleControlClient(std::shared_ptr<Channel> channel)
 {
     stub_ = VehicleControl::NewStub(channel);
+
+    mpa = new iv::modulecommext::modulecommmsg<iv::remotectrl>();
+
+    std::cout<<shmRemoteCtrl.mstrmsgname<<"---"<<shmRemoteCtrl.mnBufferSize<<"---"<<shmRemoteCtrl.mnBufferCount<<std::endl;
+    mpa->RegisterSend(shmRemoteCtrl.mstrmsgname,shmRemoteCtrl.mnBufferSize,shmRemoteCtrl.mnBufferCount);
 }
 
 VehicleControlClient::~VehicleControlClient(void)
@@ -43,9 +48,7 @@ VehicleControlClient::~VehicleControlClient(void)
 
 void VehicleControlClient::VehicleControlClientSend(void)
 {
-    mpa = new iv::modulecommext::modulecommmsg<iv::remotectrl>();
 
-    mpa->RegisterSend(shmRemoteCtrl.mstrmsgname,shmRemoteCtrl.mnBufferSize,shmRemoteCtrl.mnBufferCount);
 }
 
 std::string VehicleControlClient::vehicleControl(void)

+ 6 - 3
src/driver/driver_cloud_grpc_client_BS/vehicle_upload.cpp

@@ -39,6 +39,11 @@ using org::jeecg::defsDetails::grpc::CtrlMode;
 DataExchangeClient::DataExchangeClient(std::shared_ptr<Channel> channel)
 {
     stub_ = DataExchange::NewStub(channel);
+
+    mpa = new iv::modulecommext::modulecommmsg<iv::vision::rawpic>();
+
+    ModuleExtFun funext = std::bind(&DataExchangeClient::ListenPicMsg,this,std::placeholders::_1);
+    mpa->RegisterRecvPlus(shmPicFront.mstrmsgname,funext);
 }
 
 DataExchangeClient::~DataExchangeClient(void)
@@ -48,9 +53,7 @@ DataExchangeClient::~DataExchangeClient(void)
 
 void DataExchangeClient::CameraPicRecv()
 {
-    mpa = new iv::modulecommext::modulecommmsg<iv::vision::rawpic>();
-    ModuleExtFun funext = std::bind(&DataExchangeClient::ListenPicMsg,this,std::placeholders::_1);
-    mpa->RegisterRecvPlus(shmPicFront.mstrmsgname,funext);
+
 }
 
 void DataExchangeClient::ListenPicMsg(google::protobuf::Message &xmsg) // need a lock