org.bidib.wizard.api.service.node.CommandStationService 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.service.node;
import java.util.BitSet;
import org.bidib.api.json.types.NodeAddress;
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.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 CommandStationService {
/**
* Set the command station state.
*
* @param connectionId
* the connection id
* @param nodeAddress
* the node address
* @param csState
* the requested command station state
*/
void setCommandStationState(String connectionId, NodeAddress nodeAddress, CommandStationStatus csState);
/**
* Set the command station state.
*
* @param connectionId
* the connection id
* @param node
* the node
* @param csState
* the requested command station state
*/
void setCommandStationState(String connectionId, CommandStationNodeInterface node, CommandStationStatus csState);
/**
* Query the state of the command station.
*
* @param connectionId
* the connection id
* @param nodeAddress
* the node address
*/
void queryCommandStationState(String connectionId, NodeAddress nodeAddress);
/**
* Query the state of the command station.
*
* @param connectionId
* the connection id
* @param node
* the node
*/
void queryCommandStationState(String connectionId, CommandStationNodeInterface node);
/**
* Query the state of the command station.
*
* @param connectionId
* the connection id
* @param node
* the node
* @return the state
*/
CommandStationStatus queryCommandStationStateBlocking(String connectionId, CommandStationNodeInterface node);
/**
* Set the speed of a loco decoder.
*
* @param connectionId
* the connection id
* @param nodeAddress
* the node address
* @param locoAddress
* 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
* @param context
* the context
*/
void setSpeed(
String connectionId, NodeAddress nodeAddress, int locoAddress, SpeedSteps speedSteps, Integer speed,
DirectionStatus direction, BitSet activeFunctions, BitSet functions, final Context context);
/**
* Set the speed of a loco decoder.
*
* @param connectionId
* the connection id
* @param node
* the node
* @param locoAddress
* 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
* @param context
* the context
*/
void setSpeed(
String connectionId, CommandStationNodeInterface node, int locoAddress, SpeedSteps speedSteps, Integer speed,
DirectionStatus direction, BitSet activeFunctions, BitSet functions, final Context context);
/**
* Clear the loco or car from DCC refresh.
*
* @param connectionId
* the connection id
* @param node
* the node
* @param dccAddress
* the DCC address of the loco decoder
* @param speedSteps
* the speed steps
* @param context
* the context
*/
void clearLoco(
String connectionId, final CommandStationNodeInterface node, int dccAddress, SpeedSteps speedSteps,
final Context context);
/**
* Set the binary state on the command station node.
*
* @param connectionId
* the connection id
* @param node
* the node
* @param dccAddress
* the DCC address
* @param stateNumber
* the state number
* @param value
* the value
* @param context
* the context
*/
void setBinaryState(
String connectionId, CommandStationNodeInterface node, int dccAddress, int stateNumber, boolean value,
final Context context);
/**
* Send a CV PT request.
*
* @param connectionId
* the connection id
* @param node
* the node
* @param opCode
* the opCode
* @param cvNumber
* the CV number
* @param cvValue
* the CV value
*/
void sendCvPtRequest(
String connectionId, CommandStationNodeInterface node, CommandStationPt opCode, int cvNumber, int cvValue);
/**
* Send a CV POM request.
*
* @param connectionId
* the connection id
* @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(
String connectionId, CommandStationNodeInterface node, PomAddressData locoAddress, CommandStationPom opCode,
int cvNumber, int cvValue);
/**
* Send a read CV POM request.
*
* @param connectionId
* the connection id
* @param node
* the node
* @param locoAddress
* the loco address
* @param opCode
* the opCode
* @param cvNumber
* the CV number
* @return the acknowledge value
*/
PomAcknowledge sendReadCvPomRequest(
String connectionId, CommandStationNodeInterface node, PomAddressData locoAddress, CommandStationPom opCode,
int cvNumber);
/**
* Send a read CV POM request.
*
* @param connectionId
* the connection id
* @param node
* the node
* @param locoAddress
* the loco address
* @param opCode
* the opCode
* @param cvNumber
* the CV number
* @return the acknowledge value
*/
PomAcknowledge sendReadCvPomRequest(
String connectionId, CommandStationNodeInterface node, DecoderIdAddressData locoAddress,
CommandStationPom opCode, int cvNumber);
/**
* Set the DCC accessory decoder to the aspect (only accessory decoder for DCC!).
*
* @param connectionId
* the connection id
* @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(
String connectionId, final CommandStationNodeInterface node, AddressData dccAddress, int aspect,
Integer switchTime, TimeBaseUnitEnum timeBaseUnit, TimingControlEnum timingControl);
/**
* Stop all watchdog tasks.
*/
void stopAllWatchDogTasks();
/**
* Query the requested value from the command station.
*
* @param connectionId
* the connection id
* @param node
* the node
* @param address
* the optional address
* @param csQueryValue
* the value to query
*/
void queryCommandStationValue(
String connectionId, CommandStationNodeInterface node, CsQueryTypeEnum csQueryValue, Integer address);
/**
* Query the DCCA TID of the command station.
*
* @param connectionId
* the connection id
* @param node
* the node
*/
void queryDccAdvTid(String connectionId, CommandStationNodeInterface node);
/**
* Set the DCCA TID in the command station.
*
* @param connectionId
* the connection id
* @param node
* the node
* @param tid
* the tid data
*/
void setDccAdvTid(String connectionId, CommandStationNodeInterface node, DccATidData tid);
/**
* Send the DCCA logon enable to the command station.
*
* @param connectionId
* the connection id
* @param node
* the node
* @param type
* the logon type
* @param count
* the number of logons to send, value {@code 0} is endless
* @param interval
* the interval between logons in 100ms unit
*/
void sendDccAdvLogonEnable(
String connectionId, CommandStationNodeInterface node, DccAdvLogonType type, int count, int interval);
/**
* Send the DCCA logon assign to the command station.
*
* @param connectionId
* the connection id
* @param node
* the node
* @param didData
* the did data
* @param decoderAddress
* the decoder address to assign
*/
void sendDccAdvLogonAssign(
String connectionId, CommandStationNodeInterface node, DecoderUniqueIdData didData, int decoderAddress);
/**
* Send the DCCA select info request to the command station.
*
* @param connectionId
* the connection id
* @param node
* the node
* @param opCode
* the opcode
* @param didData
* the did data
* @param selectInfoOpCode
* the select info opCode
* @param repetitions
* the number of repetitions
*/
void sendDccAdvSelectInfo(
String connectionId, CommandStationNodeInterface node, DccAdvOpCodes opCode, DecoderUniqueIdData didData,
DccAdvSelectInfoOpCode selectInfoOpCode, int repetitions);
/**
* Send the DCCA select info request to the command station.
*
* @param connectionId
* the connection id
* @param node
* the node
* @param opCode
* the opcode
* @param getDataRepetitions
* the number of repetitions
*/
void sendDccAdvGetData(
String connectionId, CommandStationNodeInterface node, DccAdvOpCodes opCode, int repetitions);
}