Package org.openwebnet4j.message
Class BaseOpenMessage
- java.lang.Object
 - 
- org.openwebnet4j.message.OpenMessage
 - 
- org.openwebnet4j.message.BaseOpenMessage
 
 
 
- 
- Direct Known Subclasses:
 Automation,EnergyManagement,EnergyManagementDiagnostic,GatewayMgmt,Lighting,Thermoregulation,ThermoregulationDiagnostic
public abstract class BaseOpenMessage extends OpenMessage
BaseOpenMessage class is the abstract base class for other OpenWebNet message types.- Author:
 - M. Valla - Initial contribution
 
 
- 
- 
Field Summary
Fields Modifier and Type Field Description protected static StringFORMAT_DIMENSION_REQUESTprotected static StringFORMAT_DIMENSION_WRITING_1P_1Vprotected static StringFORMAT_DIMENSION_WRITING_1Vprotected static StringFORMAT_DIMENSION_WRITING_2Vprotected static StringFORMAT_REQUESTprotected static StringFORMAT_STATUSprotected static intMAX_FRAME_LENGTHprotected Wherewhereprotected StringwhereStrprotected Whowho- 
Fields inherited from class org.openwebnet4j.message.OpenMessage
FRAME_ACK, FRAME_ACK_NACK_BUSY_START, FRAME_BUSY_NACK, FRAME_END, FRAME_NACK, FRAME_START, FRAME_START_DIM, frameValue 
 - 
 
- 
Constructor Summary
Constructors Modifier Constructor Description protectedBaseOpenMessage(String frame) 
- 
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected static StringaddValues(String msgStr, String... vals)Helper method to add to the given msg frame a list of values separated by*at the end of the frame:*frame##-->*frame*val1*val2*..*valN##abstract OpenDeviceTypedetectDeviceType()Tries to return aOpenDeviceTypebased on frame valueprotected abstract DimdimFromValue(int i)int[]getCommandParams()Returns message command parameters (*WHO*WHAT#Param1#Param2...#ParamN*...), or empty array if no parameters are presentDimgetDim()Returns message DIM (dimension,*#WHO*#DIM*...##) or null id not DIM is presentint[]getDimParams()Returns an array with DIM parameters PAR1..PARN (*#WHO*DIM#PAR1..#PARN*...##), or empty array if no parameters are presentString[]getDimValues()Returns and array with DIM values, or empty array if no values are presentWhatgetWhat()Returns message WHAT or null if message has no valid WHAT partWheregetWhere()Returns message WHERE or null if message has no valid WHERE partWhogetWho()Returns message WHObooleanisCommand()Is this OpenMessage a command? (*WHO..).booleanisCommandTranslation()Check if message is a command translation (*WHO*1000#WHAT*...##)booleanisDimWriting()Check if message is a dimension writing message*#WHO*#DIM*...##static OpenMessageparse(String frame)Parses the frame and returns a new OpenMessage object.protected abstract voidparseWhere()Parse WHERE and assigns it towhereattributeStringtoStringVerbose()Get a verbose representation of this message.protected abstract WhatwhatFromValue(int i)- 
Methods inherited from class org.openwebnet4j.message.OpenMessage
equals, getFrameValue, isACK, isBUSY_NACK, isNACK, toString 
 - 
 
 - 
 
- 
- 
Field Detail
- 
MAX_FRAME_LENGTH
protected static final int MAX_FRAME_LENGTH
- See Also:
 - Constant Field Values
 
 
- 
FORMAT_DIMENSION_REQUEST
protected static final String FORMAT_DIMENSION_REQUEST
- See Also:
 - Constant Field Values
 
 
- 
FORMAT_DIMENSION_WRITING_1V
protected static final String FORMAT_DIMENSION_WRITING_1V
- See Also:
 - Constant Field Values
 
 
- 
FORMAT_DIMENSION_WRITING_2V
protected static final String FORMAT_DIMENSION_WRITING_2V
- See Also:
 - Constant Field Values
 
 
- 
FORMAT_DIMENSION_WRITING_1P_1V
protected static final String FORMAT_DIMENSION_WRITING_1P_1V
- See Also:
 - Constant Field Values
 
 
- 
FORMAT_REQUEST
protected static final String FORMAT_REQUEST
- See Also:
 - Constant Field Values
 
 
- 
FORMAT_STATUS
protected static final String FORMAT_STATUS
- See Also:
 - Constant Field Values
 
 
- 
whereStr
protected String whereStr
 
- 
who
protected Who who
 
- 
where
protected Where where
 
 - 
 
- 
Constructor Detail
- 
BaseOpenMessage
protected BaseOpenMessage(String frame)
 
 - 
 
- 
Method Detail
- 
isCommand
public boolean isCommand()
Description copied from class:OpenMessageIs this OpenMessage a command? (*WHO..).- Specified by:
 isCommandin classOpenMessage- Returns:
 - true if it's a command frame
 
 
- 
parse
public static OpenMessage parse(String frame) throws MalformedFrameException, UnsupportedFrameException
Parses the frame and returns a new OpenMessage object. This parser uses a "lazy approach": other parts (WHERE, WHAT, DIM, parameters, etc.) are not parsed until requested.- Parameters:
 frame- the frame String to parse- Returns:
 - a new 
OpenMessageobject representing the OpenWebNet frame - Throws:
 MalformedFrameException- in case the provided frame String is not a valid OpenWebNet frameUnsupportedFrameException- in case the provided frame String is not a supported OpenWebNet frame
 
- 
getWho
public Who getWho()
Returns message WHO- Returns:
 - message WHO
 
 
- 
getWhat
public What getWhat()
Returns message WHAT or null if message has no valid WHAT part- Returns:
 - message WHAT
 
 
- 
getWhere
public Where getWhere()
Returns message WHERE or null if message has no valid WHERE part- Returns:
 - message WHERE
 
 
- 
getDim
public Dim getDim()
Returns message DIM (dimension,*#WHO*#DIM*...##) or null id not DIM is present- Returns:
 - message DIM, or null if no DIM is present
 
 
- 
isDimWriting
public boolean isDimWriting()
Check if message is a dimension writing message*#WHO*#DIM*...##- Returns:
 - true if it's a dimension writing message
 
 
- 
parseWhere
protected abstract void parseWhere() throws FrameExceptionParse WHERE and assigns it towhereattribute- Throws:
 FrameException- in case of error in frame
 
- 
dimFromValue
protected abstract Dim dimFromValue(int i)
 
- 
whatFromValue
protected abstract What whatFromValue(int i)
 
- 
detectDeviceType
public abstract OpenDeviceType detectDeviceType() throws FrameException
Tries to return aOpenDeviceTypebased on frame value- Returns:
 - recognized device type or null if not device can be recognized
 - Throws:
 FrameException- in case of error in frame
 
- 
isCommandTranslation
public boolean isCommandTranslation() throws FrameExceptionCheck if message is a command translation (*WHO*1000#WHAT*...##)- Returns:
 - true if the WHAT part is prefixed with command translation: 1000#
 - Throws:
 FrameException- in case of error in frame
 
- 
getCommandParams
public int[] getCommandParams() throws FrameExceptionReturns message command parameters (*WHO*WHAT#Param1#Param2...#ParamN*...), or empty array if no parameters are present- Returns:
 - int[] of command parameters, or empty array if no parameters are present
 - Throws:
 FrameException- in case of error in frame
 
- 
getDimParams
public int[] getDimParams() throws FrameExceptionReturns an array with DIM parameters PAR1..PARN (*#WHO*DIM#PAR1..#PARN*...##), or empty array if no parameters are present- Returns:
 - a int[] of DIM parameters, or empty array if no parameters are present
 - Throws:
 FrameException- in case of error in frame
 
- 
getDimValues
public String[] getDimValues() throws FrameException
Returns and array with DIM values, or empty array if no values are present- Returns:
 - a String[] of DIM values, or empty array if no values are present
 - Throws:
 FrameException- in case of error in frame
 
- 
addValues
protected static String addValues(String msgStr, String... vals)
Helper method to add to the given msg frame a list of values separated by*at the end of the frame:*frame##-->*frame*val1*val2*..*valN##- Parameters:
 msgStr- the input frame Stringvals- Strings containing values to be added to the frame- Returns:
 - a String with the new message frame with values added at the end
 
 
- 
toStringVerbose
public String toStringVerbose()
Description copied from class:OpenMessageGet a verbose representation of this message.- Specified by:
 toStringVerbosein classOpenMessage- Returns:
 - verbose string representation
 
 
 - 
 
 -