|
|
@ -11,6 +11,7 @@ import a8k.app.utils.ZJsonHelper; |
|
|
|
import jakarta.annotation.PostConstruct; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
|
|
|
|
@Component |
|
|
@ -21,26 +22,29 @@ public class LisCommunicationService { |
|
|
|
private final LisUartChannel lisUartChannel; |
|
|
|
private LISSetting setting; |
|
|
|
|
|
|
|
BiLisSingleTrackChannel boditechLisSingleTrackChannel; |
|
|
|
@Value("${lis.enable}") |
|
|
|
public Boolean lisEnable = true; |
|
|
|
|
|
|
|
BiLisSingleTrackChannel boditechLisSingleTrackChannel; |
|
|
|
public void updateLisSetting(LISSetting lisSetting) { |
|
|
|
if (!lisEnable) { |
|
|
|
log.warn("LIS communication is disabled by configuration, ignore updateLisSetting"); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
log.info("updateLisSetting: {}", ZJsonHelper.objToPrettyJson(lisSetting)); |
|
|
|
setting = lisSetting; |
|
|
|
doUpdateLisSetting(); |
|
|
|
} |
|
|
|
|
|
|
|
public String getProtocolDetail() { |
|
|
|
|
|
|
|
if (isChannelEq(LISProtocolEnum.Boditech, LISDirectionTypeEnum.SINGLE_TRACK, LISIFType.SERIAL)) { |
|
|
|
return String.format("%s.%s.%s,baudrate:%s", setting.lisProtocol, setting.lisType, setting.lisIf, setting.lisSerialBaudrate.baudrate); |
|
|
|
} |
|
|
|
else if (isChannelEq(LISProtocolEnum.Boditech, LISDirectionTypeEnum.SINGLE_TRACK, LISIFType.NETWORK)) { |
|
|
|
} else if (isChannelEq(LISProtocolEnum.Boditech, LISDirectionTypeEnum.SINGLE_TRACK, LISIFType.NETWORK)) { |
|
|
|
return String.format("%s.%s.%s,ip:%s,port:%d", setting.lisProtocol, setting.lisType, setting.lisIf, setting.lisNetIp, setting.lisNetPort); |
|
|
|
} else { |
|
|
|
return String.format("%s.%s.%s", setting.lisProtocol, setting.lisType, setting.lisIf); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public Boolean getConnectionState() { |
|
|
@ -64,6 +68,10 @@ public class LisCommunicationService { |
|
|
|
@PostConstruct |
|
|
|
public void init() { |
|
|
|
log.info("LisCommunicationService init"); |
|
|
|
if (!lisEnable) { |
|
|
|
log.warn("LIS communication is disabled by configuration."); |
|
|
|
return; |
|
|
|
} |
|
|
|
setting = appSettingsMgrService.getLISSetting(); |
|
|
|
doUpdateLisSetting(); |
|
|
|
} |
|
|
|