Commit a394487f by xjp0422

protobuf异常捕获 TDSCmd更新

parent b2af52f6
No preview for this file type
...@@ -50,6 +50,8 @@ namespace Mqtt_AGI ...@@ -50,6 +50,8 @@ namespace Mqtt_AGI
//获取配置信息中的站点等级信息 生成LevelUid //获取配置信息中的站点等级信息 生成LevelUid
static void Level_Topic_Uid_init() static void Level_Topic_Uid_init()
{ {
try
{
string IniPath = System.Windows.Forms.Application.StartupPath + "\\config.ini"; string IniPath = System.Windows.Forms.Application.StartupPath + "\\config.ini";
StringBuilder level1 = new StringBuilder(16); StringBuilder level1 = new StringBuilder(16);
StringBuilder level2 = new StringBuilder(16); StringBuilder level2 = new StringBuilder(16);
...@@ -58,15 +60,22 @@ namespace Mqtt_AGI ...@@ -58,15 +60,22 @@ namespace Mqtt_AGI
GetPrivateProfileString("role", "level2", "0", level2, 16, IniPath); GetPrivateProfileString("role", "level2", "0", level2, 16, IniPath);
GetPrivateProfileString("role", "level3", "0", level3, 16, IniPath); GetPrivateProfileString("role", "level3", "0", level3, 16, IniPath);
//Console.WriteLine(SerializeUid.SerilizeString(Convert.ToUInt32(level1.ToString()), Convert.ToUInt32(level2.ToString()), Convert.ToUInt32(level3.ToString()))); //Console.WriteLine(SerializeUid.SerilizeString(Convert.ToUInt32(level1.ToString()), Convert.ToUInt32(level2.ToString()), Convert.ToUInt32(level3.ToString())));
LevelTopic= SerializeUid.Serilize_Init_Level_Topic(Convert.ToUInt32(level1.ToString()), Convert.ToUInt32(level2.ToString()), Convert.ToUInt32(level3.ToString())); LevelTopic = SerializeUid.Serilize_Init_Level_Topic(Convert.ToUInt32(level1.ToString()), Convert.ToUInt32(level2.ToString()), Convert.ToUInt32(level3.ToString()));
LevelUid = SerializeUid.Serilize_Init_Level_Uid(Convert.ToUInt32(level1.ToString()) , Convert.ToUInt32(level2.ToString()) , Convert.ToUInt32(level3.ToString())); LevelUid = SerializeUid.Serilize_Init_Level_Uid(Convert.ToUInt32(level1.ToString()), Convert.ToUInt32(level2.ToString()), Convert.ToUInt32(level3.ToString()));
clientId = SerializeUid.SerilizeUid(LevelUid, systemID.AGI); clientId = SerializeUid.SerilizeUid(LevelUid, systemID.AGI);
Console.WriteLine("MqttclientId:" + clientId); Console.WriteLine("MqttclientId:" + clientId);
//Console.WriteLine(Convert.ToString(subTopic,2).PadLeft(32,'0'));//32位 前面补0 //Console.WriteLine(Convert.ToString(subTopic,2).PadLeft(32,'0'));//32位 前面补0
} }
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
static void heart_thread() { static void heart_thread() {
//初始化包配置 //初始化包配置
try
{
while (true) while (true)
{ {
Heartbeat heartbeat = new Heartbeat(); Heartbeat heartbeat = new Heartbeat();
...@@ -88,11 +97,17 @@ namespace Mqtt_AGI ...@@ -88,11 +97,17 @@ namespace Mqtt_AGI
Thread.Sleep(1000 * 10); Thread.Sleep(1000 * 10);
} }
} }
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
static void client_MqttMsgPublishReceived(object sender, MqttMsgPublishEventArgs e) static void client_MqttMsgPublishReceived(object sender, MqttMsgPublishEventArgs e)
{ {
//处理接收到的消息 protobuf协议 //处理接收到的消息 protobuf协议
try
{
TDSCmd datastruct = TDSCmd.Parser.ParseFrom(e.Message); TDSCmd datastruct = TDSCmd.Parser.ParseFrom(e.Message);
Console.WriteLine("收到消息 反序列化:" + datastruct + "\r\n"); Console.WriteLine("收到消息 反序列化:" + datastruct + "\r\n");
...@@ -100,7 +115,7 @@ namespace Mqtt_AGI ...@@ -100,7 +115,7 @@ namespace Mqtt_AGI
for (int messageNum = 0; messageNum < datastruct.Parameters.Count; ++messageNum) for (int messageNum = 0; messageNum < datastruct.Parameters.Count; ++messageNum)
{ {
Parameter = datastruct.Parameters[messageNum]; Parameter = datastruct.Parameters[messageNum];
if(datastruct.InterfaceId == IID.AgiReport) if (datastruct.InterfaceId == IID.AgiReport)
{ {
CalcReportReq CalcReport = Parameter.Unpack<CalcReportReq>(); CalcReportReq CalcReport = Parameter.Unpack<CalcReportReq>();
string[] args = { CalcReport.StartDateTime,CalcReport.EndDateTime, string[] args = { CalcReport.StartDateTime,CalcReport.EndDateTime,
...@@ -123,6 +138,11 @@ namespace Mqtt_AGI ...@@ -123,6 +138,11 @@ namespace Mqtt_AGI
CalcTle.Raan.ToString(),CalcTle.Arc.ToString(),CalcTle.M.ToString() }; CalcTle.Raan.ToString(),CalcTle.Arc.ToString(),CalcTle.M.ToString() };
calc_tle(args); //精轨转TLE calc_tle(args); //精轨转TLE
} }
}
}
catch (Exception ex) {
Console.WriteLine(ex.Message);
} }
//轨道预报 //轨道预报
//处理接收到的消息 //处理接收到的消息
...@@ -560,6 +580,7 @@ namespace Mqtt_AGI ...@@ -560,6 +580,7 @@ namespace Mqtt_AGI
//protobuf xxd begin //protobuf xxd begin
/* 测试先不发送xxd*/
Xxd xxd = new Xxd(); Xxd xxd = new Xxd();
xxd.Dt = xxd_date; xxd.Dt = xxd_date;
xxd.Lon = longtitude; xxd.Lon = longtitude;
...@@ -567,6 +588,7 @@ namespace Mqtt_AGI ...@@ -567,6 +588,7 @@ namespace Mqtt_AGI
xxd.Height = altitude / 1000.0; xxd.Height = altitude / 1000.0;
CalcReport.Xxds.Add(xxd); CalcReport.Xxds.Add(xxd);
//end //end
//JObject XxdObject = new JObject(); //JObject XxdObject = new JObject();
......
b30ae5d6ea524ee0ee189b3222a07c4c6c7596c1 a355bbb913a05c0d56683ebbb94f068d51ee8b9c
...@@ -169,9 +169,11 @@ enum IID : int { ...@@ -169,9 +169,11 @@ enum IID : int {
IID_Server_TaskListSend_respond = 10424, IID_Server_TaskListSend_respond = 10424,
IID_Server_TaskListReceive = 10425, IID_Server_TaskListReceive = 10425,
IID_Server_TaskListReceive_respond = 10426, IID_Server_TaskListReceive_respond = 10426,
IID_Server_FileReceive = 10427, IID_Server_FileSend = 10427,
IID_Server_FileReceive_respond = 10428, IID_Server_FileSend_respond = 10428,
IID_Server_TaskExecAnalysisResult = 105, IID_Server_FileReceive = 10429,
IID_Server_FileReceive_respond = 10430,
IID_Server_TaskExecAnalysisResult = 10501,
IID_Server_TaskExecAnalysisResult_respond = 10502, IID_Server_TaskExecAnalysisResult_respond = 10502,
IID_Server_TaskExecList = 10503, IID_Server_TaskExecList = 10503,
IID_Server_TaskExecList_respond = 10504, IID_Server_TaskExecList_respond = 10504,
...@@ -857,16 +859,17 @@ class TDSCmd final : ...@@ -857,16 +859,17 @@ class TDSCmd final :
// accessors ------------------------------------------------------- // accessors -------------------------------------------------------
enum : int { enum : int {
kParametersFieldNumber = 8, kParametersFieldNumber = 9,
kTsFieldNumber = 7, kTsFieldNumber = 8,
kInterfaceIdFieldNumber = 1, kInterfaceIdFieldNumber = 1,
kDstSuidFieldNumber = 2, kDstSuidFieldNumber = 2,
kSrcSuidFieldNumber = 3, kSrcSuidFieldNumber = 3,
kForwardFlagFieldNumber = 4, kForwardFlagFieldNumber = 4,
kPriorityFieldNumber = 5,
kRequestIndexFieldNumber = 6, kRequestIndexFieldNumber = 6,
kPriorityFieldNumber = 5,
kOperationsTypeFieldNumber = 7,
}; };
// repeated .google.protobuf.Any parameters = 8; // repeated .google.protobuf.Any parameters = 9;
int parameters_size() const; int parameters_size() const;
private: private:
int _internal_parameters_size() const; int _internal_parameters_size() const;
...@@ -884,7 +887,7 @@ class TDSCmd final : ...@@ -884,7 +887,7 @@ class TDSCmd final :
const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Any >& const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Any >&
parameters() const; parameters() const;
// .google.protobuf.Timestamp ts = 7; // .google.protobuf.Timestamp ts = 8;
bool has_ts() const; bool has_ts() const;
private: private:
bool _internal_has_ts() const; bool _internal_has_ts() const;
...@@ -938,6 +941,15 @@ class TDSCmd final : ...@@ -938,6 +941,15 @@ class TDSCmd final :
void _internal_set_forward_flag(uint32_t value); void _internal_set_forward_flag(uint32_t value);
public: public:
// uint64 request_index = 6;
void clear_request_index();
uint64_t request_index() const;
void set_request_index(uint64_t value);
private:
uint64_t _internal_request_index() const;
void _internal_set_request_index(uint64_t value);
public:
// uint32 priority = 5; // uint32 priority = 5;
void clear_priority(); void clear_priority();
uint32_t priority() const; uint32_t priority() const;
...@@ -947,13 +959,13 @@ class TDSCmd final : ...@@ -947,13 +959,13 @@ class TDSCmd final :
void _internal_set_priority(uint32_t value); void _internal_set_priority(uint32_t value);
public: public:
// uint32 request_index = 6; // uint32 operations_type = 7;
void clear_request_index(); void clear_operations_type();
uint32_t request_index() const; uint32_t operations_type() const;
void set_request_index(uint32_t value); void set_operations_type(uint32_t value);
private: private:
uint32_t _internal_request_index() const; uint32_t _internal_operations_type() const;
void _internal_set_request_index(uint32_t value); void _internal_set_operations_type(uint32_t value);
public: public:
// @@protoc_insertion_point(class_scope:TDSCmd) // @@protoc_insertion_point(class_scope:TDSCmd)
...@@ -969,8 +981,9 @@ class TDSCmd final : ...@@ -969,8 +981,9 @@ class TDSCmd final :
uint32_t dst_suid_; uint32_t dst_suid_;
uint32_t src_suid_; uint32_t src_suid_;
uint32_t forward_flag_; uint32_t forward_flag_;
uint64_t request_index_;
uint32_t priority_; uint32_t priority_;
uint32_t request_index_; uint32_t operations_type_;
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
friend struct ::TableStruct_TDSCmd_2eproto; friend struct ::TableStruct_TDSCmd_2eproto;
}; };
...@@ -1287,27 +1300,47 @@ inline void TDSCmd::set_priority(uint32_t value) { ...@@ -1287,27 +1300,47 @@ inline void TDSCmd::set_priority(uint32_t value) {
// @@protoc_insertion_point(field_set:TDSCmd.priority) // @@protoc_insertion_point(field_set:TDSCmd.priority)
} }
// uint32 request_index = 6; // uint64 request_index = 6;
inline void TDSCmd::clear_request_index() { inline void TDSCmd::clear_request_index() {
request_index_ = 0u; request_index_ = uint64_t{0u};
} }
inline uint32_t TDSCmd::_internal_request_index() const { inline uint64_t TDSCmd::_internal_request_index() const {
return request_index_; return request_index_;
} }
inline uint32_t TDSCmd::request_index() const { inline uint64_t TDSCmd::request_index() const {
// @@protoc_insertion_point(field_get:TDSCmd.request_index) // @@protoc_insertion_point(field_get:TDSCmd.request_index)
return _internal_request_index(); return _internal_request_index();
} }
inline void TDSCmd::_internal_set_request_index(uint32_t value) { inline void TDSCmd::_internal_set_request_index(uint64_t value) {
request_index_ = value; request_index_ = value;
} }
inline void TDSCmd::set_request_index(uint32_t value) { inline void TDSCmd::set_request_index(uint64_t value) {
_internal_set_request_index(value); _internal_set_request_index(value);
// @@protoc_insertion_point(field_set:TDSCmd.request_index) // @@protoc_insertion_point(field_set:TDSCmd.request_index)
} }
// .google.protobuf.Timestamp ts = 7; // uint32 operations_type = 7;
inline void TDSCmd::clear_operations_type() {
operations_type_ = 0u;
}
inline uint32_t TDSCmd::_internal_operations_type() const {
return operations_type_;
}
inline uint32_t TDSCmd::operations_type() const {
// @@protoc_insertion_point(field_get:TDSCmd.operations_type)
return _internal_operations_type();
}
inline void TDSCmd::_internal_set_operations_type(uint32_t value) {
operations_type_ = value;
}
inline void TDSCmd::set_operations_type(uint32_t value) {
_internal_set_operations_type(value);
// @@protoc_insertion_point(field_set:TDSCmd.operations_type)
}
// .google.protobuf.Timestamp ts = 8;
inline bool TDSCmd::_internal_has_ts() const { inline bool TDSCmd::_internal_has_ts() const {
return this != internal_default_instance() && ts_ != nullptr; return this != internal_default_instance() && ts_ != nullptr;
} }
...@@ -1392,7 +1425,7 @@ inline void TDSCmd::set_allocated_ts(::PROTOBUF_NAMESPACE_ID::Timestamp* ts) { ...@@ -1392,7 +1425,7 @@ inline void TDSCmd::set_allocated_ts(::PROTOBUF_NAMESPACE_ID::Timestamp* ts) {
// @@protoc_insertion_point(field_set_allocated:TDSCmd.ts) // @@protoc_insertion_point(field_set_allocated:TDSCmd.ts)
} }
// repeated .google.protobuf.Any parameters = 8; // repeated .google.protobuf.Any parameters = 9;
inline int TDSCmd::_internal_parameters_size() const { inline int TDSCmd::_internal_parameters_size() const {
return parameters_.size(); return parameters_.size();
} }
......
...@@ -98,9 +98,11 @@ enum IID ...@@ -98,9 +98,11 @@ enum IID
IID_Server_TaskListSend_respond = 10424; IID_Server_TaskListSend_respond = 10424;
IID_Server_TaskListReceive = 10425; IID_Server_TaskListReceive = 10425;
IID_Server_TaskListReceive_respond = 10426; IID_Server_TaskListReceive_respond = 10426;
IID_Server_FileReceive = 10427; IID_Server_FileSend = 10427;
IID_Server_FileReceive_respond = 10428; IID_Server_FileSend_respond = 10428;
IID_Server_TaskExecAnalysisResult = 105; IID_Server_FileReceive = 10429;
IID_Server_FileReceive_respond = 10430;
IID_Server_TaskExecAnalysisResult = 10501;
IID_Server_TaskExecAnalysisResult_respond = 10502; IID_Server_TaskExecAnalysisResult_respond = 10502;
IID_Server_TaskExecList = 10503; IID_Server_TaskExecList = 10503;
IID_Server_TaskExecList_respond = 10504;//list IID_Server_TaskExecList_respond = 10504;//list
...@@ -263,7 +265,8 @@ message TDSCmd ...@@ -263,7 +265,8 @@ message TDSCmd
uint32 src_suid = 3; uint32 src_suid = 3;
uint32 forward_flag = 4; uint32 forward_flag = 4;
uint32 priority = 5; //报文优先级 可以优先发送 uint32 priority = 5; //报文优先级 可以优先发送
uint32 request_index = 6; uint64 request_index = 6;
google.protobuf.Timestamp ts = 7; uint32 operations_type =7;
repeated google.protobuf.Any parameters = 8; google.protobuf.Timestamp ts = 8;
repeated google.protobuf.Any parameters = 9;
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment