org.yamcs.sle.TmSleLink Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of yamcs-sle Show documentation
Show all versions of yamcs-sle Show documentation
Data links for connecting Yamcs to SLE (Space Link Extension) providers such as Ground Stations
package org.yamcs.sle;
import java.util.concurrent.CompletableFuture;
import org.yamcs.ConfigurationException;
import org.yamcs.YConfiguration;
import org.yamcs.tctm.ccsds.UdpTmFrameLink;
import org.yamcs.sle.Constants.DeliveryMode;
import org.yamcs.sle.user.RafServiceUserHandler;
import org.yamcs.sle.user.RcfServiceUserHandler;
/**
* Receives TM frames via SLE. The Virtual Channel configuration is identical with the configuration of
* {@link UdpTmFrameLink}.
*
* The SLE specific settings are loaded from sle.yaml based on the sleProvider key specified in the link configuration.
* The description of the sle.yaml configuration parameters are as follows:
*
*
* initiatorId
* identifier of the local application
*
*
* responderPortId
* Responder Port Identifier
*
* versionNumber
* the version number is sent in the bind invocation. We only support the version of the SLE valid in April-2019;
* however this field is not checked.
*
*
*
* myUsername
* username that is passed in outgoing SLE messages. A corresponding password has to be specified (in hexadecimal)
* in the security.yaml file.
*
*
* peerUsername
* username that is used to verify the incoming SLE messages. A corresponding password has to be specified (in
* hexadecimal) in the security.yaml file.
*
*
* authLevel
* one of NONE, BIND or ALL - it configures which incoming and outgoing PDUs contain authentication
* information.
*
*
* service
* One of RAF (return all frames) or RCF (return channel frames).
*
*
* rcfTfVersion
* Specifies the requested frame version number (0=TM, 1=AOS, 12=USLP).
* If this option is not used, the frame version number will be derived from the frameType. If specfied, no validation
* is performed but sent as configured to the SLE provider.
*
*
*
* rcfSpacecraftId
* Specifies the number sent as part of the RCF request to the SLE provider. If not specified the spacecraftId will be used.
*
*
* rcfVcId
* Specifies the virtual channel sent as part of the RCF request. If not specified, or if negative, the request will be sent for all VCs
*
*
*
* deliveryMode
* one of timely, or complete
*
*
*
*
*
*
* @author nm
*
*/
public class TmSleLink extends AbstractTmSleLink {
RacfSleMonitor sleMonitor = new MyMonitor();
public void init(String instance, String name, YConfiguration config) throws ConfigurationException {
super.init(instance, name, config, getDeliveryMode(config));
reconnectionIntervalSec = config.getInt("reconnectionIntervalSec", 30);
}
private DeliveryMode getDeliveryMode(YConfiguration config) {
String dm = config.getString("deliveryMode");
if("timely".equalsIgnoreCase(dm)) {
return DeliveryMode.rtnTimelyOnline;
} else if ("complete".equalsIgnoreCase(dm)) {
return DeliveryMode.rtnCompleteOnline;
} else {
throw new ConfigurationException("Invalid value '"+dm+"' for deliverMode. Please use 'timely' or 'complete'");
}
}
@Override
protected void doStart() {
if (!isDisabled()) {
connect();
}
notifyStarted();
}
@Override
protected void doStop() {
if (rsuh != null) {
rsuh.shutdown();
rsuh = null;
}
notifyStopped();
}
protected void sleStart() {
CompletableFuture cf;
if(gvcid==null) {
cf = ((RafServiceUserHandler)rsuh).start();
} else {
cf = ((RcfServiceUserHandler)rsuh).start(gvcid);
}
cf.handle((v, t) -> {
if (t != null) {
eventProducer.sendWarning("Failed to start: " + t.getMessage());
return null;
}
return null;
});
}
@Override
protected void doDisable() {
if (rsuh != null) {
rsuh.shutdown();
rsuh = null;
}
}
@Override
protected void doEnable() throws Exception {
connect();
}
@Override
public void onEndOfData() {
eventProducer.sendInfo("SLE end of data received");
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy