org.bidib.wizard.api.model.connection.CommandStationConnection Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bidibwizard-api Show documentation
Show all versions of bidibwizard-api Show documentation
jBiDiB BiDiB Wizard API POM
package org.bidib.wizard.api.model.connection;
import java.util.BitSet;
import org.bidib.jbidibc.messages.AddressData;
import org.bidib.jbidibc.messages.DccATidData;
import org.bidib.jbidibc.messages.DecoderIdAddressData;
import org.bidib.jbidibc.messages.DecoderUniqueIdData;
import org.bidib.jbidibc.messages.PomAddressData;
import org.bidib.jbidibc.messages.enums.AccessoryAcknowledge;
import org.bidib.jbidibc.messages.enums.CommandStationPom;
import org.bidib.jbidibc.messages.enums.CommandStationPt;
import org.bidib.jbidibc.messages.enums.CommandStationState;
import org.bidib.jbidibc.messages.enums.CsQueryTypeEnum;
import org.bidib.jbidibc.messages.enums.DccAdvLogonType;
import org.bidib.jbidibc.messages.enums.DccAdvOpCodes;
import org.bidib.jbidibc.messages.enums.DccAdvSelectInfoOpCode;
import org.bidib.jbidibc.messages.enums.PomAcknowledge;
import org.bidib.jbidibc.messages.enums.TimeBaseUnitEnum;
import org.bidib.jbidibc.messages.enums.TimingControlEnum;
import org.bidib.jbidibc.messages.helpers.Context;
import org.bidib.wizard.api.model.CommandStationNodeInterface;
import org.bidib.wizard.model.status.CommandStationStatus;
import org.bidib.wizard.model.status.DirectionStatus;
import org.bidib.wizard.model.status.SpeedSteps;
public interface CommandStationConnection {
/**
* Set the new command station state.
*
* @param node
* the node
* @param commandStationState
* the new command station state
*/
void setCommandStationState(CommandStationNodeInterface node, CommandStationStatus commandStationState);
/**
* Query the state of the command station.
*
* @param node
* the node
* @return the state of the command station
*/
CommandStationState queryCommandStationState(CommandStationNodeInterface node);
/**
* Send a CV PT request.
*
* @param node
* the node
* @param opCode
* the opCode
* @param cvNumber
* the CV number
* @param cvValue
* the CV value
*/
void sendCvPtRequest(CommandStationNodeInterface node, CommandStationPt opCode, int cvNumber, int cvValue);
/**
* Send a CV POM request.
*
* @param node
* the node
* @param locoAddress
* the loco address
* @param opCode
* the opCode
* @param cvNumber
* the CV number
* @param cvValue
* the CV value to write (ignored for read opCodes)
* @return the acknowledge value
*/
PomAcknowledge sendCvPomRequest(
CommandStationNodeInterface node, PomAddressData locoAddress, CommandStationPom opCode, int cvNumber,
int cvValue);
/**
* Send a read CV POM request.
*
* @param node
* the node
* @param locoAddress
* the loco address
* @param opCode
* the opCode
* @param cvNumber
* the CV number
* @return the acknowledge value
*/
PomAcknowledge sendReadCvPomRequest(
CommandStationNodeInterface node, PomAddressData locoAddress, CommandStationPom opCode, int cvNumber);
/**
* Send a read CV POM request.
*
* @param node
* the node
* @param locoAddress
* the loco address
* @param opCode
* the opCode
* @param cvNumber
* the CV number
* @return the acknowledge value
*/
PomAcknowledge sendReadCvPomRequest(
CommandStationNodeInterface node, DecoderIdAddressData locoAddress, CommandStationPom opCode, int cvNumber);
/**
* Set the speed of a loco decoder.
*
* @param node
* the node
* @param dccAddress
* the DCC address of the loco decoder
* @param speedSteps
* the speed steps
* @param speed
* the speed
* @param direction
* the direction to drive
* @param activeFunctions
* active functions
* @param functions
* functions
*/
void setSpeed(
CommandStationNodeInterface node, int dccAddress, SpeedSteps speedSteps, Integer speed,
DirectionStatus direction, BitSet activeFunctions, BitSet functions, final Context context);
/**
* Clear the loco or car from DCC refresh.
*
* @param node
* the node
* @param dccAddress
* the DCC address of the loco decoder
* @param speedSteps
* the speed steps
* @param context
* the context
*/
void clearLoco(
final CommandStationNodeInterface node, int dccAddress, final SpeedSteps speedSteps, final Context context);
/**
* Set the binary state on the command station node.
*
* @param node
* the node
* @param dccAddress
* the DCC address
* @param stateNumber
* the state number
* @param value
* the value
*/
void setBinaryState(
final CommandStationNodeInterface node, int dccAddress, int stateNumber, boolean value, final Context context);
/**
* Set the DCC accessory decoder to the aspect (only accessory decoder for DCC!).
*
* @param node
* the node
* @param dccAddress
* the DCC address of the accessory decoder
* @param aspect
* the aspect
* @param switchTime
* the switch time
* @param timeBaseUnit
* the time base unit (100ms or 1s)
* @param timingControl
* the timing control
* @return the accessory acknowledge
*/
AccessoryAcknowledge setDccAccessory(
final CommandStationNodeInterface node, AddressData dccAddress, int aspect, Integer switchTime,
TimeBaseUnitEnum timeBaseUnit, TimingControlEnum timingControl);
/**
* Query the requested value from the command station.
*
* @param node
* the node
* @param address
* the optional address
* @param csQueryValue
* the value to query
*/
void queryCommandStationValue(
final CommandStationNodeInterface node, CsQueryTypeEnum csQueryValue, Integer address);
/**
* Query the DccAdv TID from the command station node. The TID is signaled asynchronously.
*
* @param node
* the node
*/
void queryDccAdvTid(final CommandStationNodeInterface node);
/**
* Set the DccAdv TID on the command station node.
*
* @param node
* the node
* @param tid
* the TID to set
*/
void setDccAdvTid(final CommandStationNodeInterface node, DccATidData tid);
/**
* Send the logon enable event for DccAdv.
*
* @param node
* the node
* @param type
* the type of logon
* @param repetitions
* the number repetitions, {@code 0}: forever
* @param interval
* the interval in unit of 100ms
*/
void sendDccAdvLogonEnable(
final CommandStationNodeInterface node, DccAdvLogonType type, int repetitions, int interval);
/**
* Send the logon assign event for DccAdv.
*
* @param node
* the node
* @param did
* the DID to address
* @param address
* the address
*/
void sendDccAdvLogonAssign(final CommandStationNodeInterface node, DecoderUniqueIdData did, int address);
/**
* Send the get info request for DccAdv.
*
* @param node
* the node
* @param opCode
* the opCode
* @param did
* the DID to address
* @param selectInfoOpCode
* the select info opCode
* @param repetitions
* the number of repetitions
*/
void sendDccAdvSelectInfo(
final CommandStationNodeInterface node, DccAdvOpCodes opCode, DecoderUniqueIdData did,
DccAdvSelectInfoOpCode selectInfoOpCode, int repetitions);
/**
* Send the get data request for DccAdv.
*
* @param node
* the node
* @param opCode
* the opCode
*/
void sendDccAdvGetData(final CommandStationNodeInterface node, DccAdvOpCodes opCode, int repetitions);
}