25 lines
909 B
Go
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
|
|
}
|