rts-sim-testing-service/third_party/third_party.go
walker 62b44a0cc6 添加UDP网络延时记录器
动力学和半实物接口添加UDP网络监控功能
2024-01-22 13:10:10 +08:00

25 lines
909 B
Go

package third_party
import (
"joylink.club/bj-rtsts-server/dto/state_proto"
"joylink.club/bj-rtsts-server/third_party/dynamics"
"joylink.club/bj-rtsts-server/third_party/tpapi"
)
func GetRunningServiceStates(t state_proto.SimulationThirdPartyApiService_Type) *state_proto.SimulationThirdPartyApiService {
ss := &state_proto.SimulationThirdPartyApiService{}
switch dynamics.Default().State() {
case tpapi.ThirdPartyState_Normal:
ss.States = append(ss.States, &state_proto.SimulationThirdPartyApiServiceState{
Type: state_proto.SimulationThirdPartyApiService_Dynamics,
State: state_proto.SimulationThirdPartyApiService_Normal,
})
case tpapi.ThirdPartyState_Broken:
ss.States = append(ss.States, &state_proto.SimulationThirdPartyApiServiceState{
Type: state_proto.SimulationThirdPartyApiService_Dynamics,
State: state_proto.SimulationThirdPartyApiService_Error,
})
}
return ss
}