1、增加葛洲坝10分钟推送组
This commit is contained in:
parent
7afdaa29dd
commit
d05e2c7adf
@ -0,0 +1,42 @@
|
||||
package com.imdroid.beidou_fwd.task;
|
||||
|
||||
import com.imdroid.beidou_fwd.service.TCPClient;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
@Component
|
||||
@Configuration
|
||||
@EnableScheduling
|
||||
public class GZB10mForwarder extends GXXfzForwarder{
|
||||
private final String FORWARDER_NAME = "葛洲坝10分钟";
|
||||
@Value("${gzb.server.host}")
|
||||
private String host;
|
||||
|
||||
@Value("${gzb.server.port}")
|
||||
private int port;
|
||||
private boolean enabled=false;
|
||||
|
||||
@PostConstruct
|
||||
void registerMe(){
|
||||
init(FORWARDER_NAME, "TCP "+host+":"+port,1,FWD_DEVICE_ID,10);
|
||||
xfzTcpClient = new TCPClient();
|
||||
xfzTcpClient.init(host, port,listener);
|
||||
if(!enabled) return;
|
||||
xfzTcpClient.start();
|
||||
}
|
||||
|
||||
/**
|
||||
* 每半小时转发GNSS解算结果
|
||||
*/
|
||||
@Scheduled(cron = "0 0/10 * * * ?") // 每10分钟执行一次
|
||||
private void forwardGnss() {
|
||||
if(!enabled) return;
|
||||
logger.debug("gzb forwardGnss");
|
||||
forwardCurrentGnss();
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user