|
@@ -63,6 +63,15 @@ int grpcpc::Produceh264frame(int ncampos,iv::h264rawframedata & xframe)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+int64_t grpcpc::GetFrameCount(int ncampos)
|
|
|
+{
|
|
|
+ if(mbUseRTSP)
|
|
|
+ {
|
|
|
+ return mprtspdown[ncampos]->GetFrameCount();
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
int grpcpc::Consumeh264frame(int ncampos,iv::h264rawframedata & xframe)
|
|
|
{
|
|
|
if(mbUseRTSP)
|
|
@@ -257,6 +266,9 @@ void grpcpc::run()
|
|
|
timespec.tv_nsec = 0;
|
|
|
timespec.clock_type = GPR_TIMESPAN;
|
|
|
|
|
|
+ mstrConnectState = "Connecting...";
|
|
|
+
|
|
|
+ unsigned int nnodata = 10;
|
|
|
|
|
|
while(!QThread::isInterruptionRequested())
|
|
|
{
|
|
@@ -351,12 +363,14 @@ void grpcpc::run()
|
|
|
// xTime1.start();
|
|
|
Status status = stub_->queryctrl(&context, request, &xreply);
|
|
|
if (status.ok()) {
|
|
|
+ mstrConnectState = "Connected.";
|
|
|
// std::cout<<" query time: "<<xTime1.elapsed()<<std::endl;
|
|
|
std::cout<<nid<<" query successfully, res is "<<xreply.nres()<<std::endl;
|
|
|
if(xreply.nres() == 1)
|
|
|
{
|
|
|
|
|
|
-
|
|
|
+ nnodata = 0;
|
|
|
+ mstrVehicleState = "Online.";
|
|
|
if(nlasttime != xmsg.xtime())
|
|
|
{
|
|
|
iv::cloud::cloudmsg xmsg;
|
|
@@ -372,6 +386,12 @@ void grpcpc::run()
|
|
|
else
|
|
|
{
|
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(30));
|
|
|
+ if(nnodata < 10000000) nnodata++;
|
|
|
+ if(nnodata>10)
|
|
|
+ {
|
|
|
+ mstrVehicleState = "Offline.";
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
} else {
|
|
|
std::cout << status.error_code() << ": " << status.error_message()
|
|
@@ -385,6 +405,7 @@ void grpcpc::run()
|
|
|
target_str, grpc::InsecureChannelCredentials(),cargs);
|
|
|
|
|
|
stub_ = iv::UploadThread::NewStub(channel);
|
|
|
+ mstrConnectState = "Connecting.";
|
|
|
}
|
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(900));
|
|
|
|
|
@@ -596,4 +617,14 @@ void grpcpc::setctrlMD5(std::string strmd5)
|
|
|
gstrctrlMD5 = strmd5;
|
|
|
}
|
|
|
|
|
|
+std::string grpcpc::GetConnectState()
|
|
|
+{
|
|
|
+ return mstrConnectState;
|
|
|
+}
|
|
|
+
|
|
|
+std::string grpcpc::GetVehicleState()
|
|
|
+{
|
|
|
+ return mstrVehicleState;
|
|
|
+}
|
|
|
+
|
|
|
|