Package org.openwebnet4j.message
Class Lighting
- java.lang.Object
-
- org.openwebnet4j.message.OpenMessage
-
- org.openwebnet4j.message.BaseOpenMessage
-
- org.openwebnet4j.message.Lighting
-
public class Lighting extends BaseOpenMessage
OpenWebNet Lighting messages (WHO=1)- Author:
- M. Valla - Initial contribution
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Lighting.DIM
static class
Lighting.WHAT
-
Field Summary
Fields Modifier and Type Field Description static int
DIMMER_LEVEL_100_MAX
static int
DIMMER_LEVEL_100_OFF
-
Fields inherited from class org.openwebnet4j.message.BaseOpenMessage
FORMAT_DIMENSION_REQUEST, FORMAT_DIMENSION_WRITING_1P_1V, FORMAT_DIMENSION_WRITING_1V, FORMAT_DIMENSION_WRITING_2V, FORMAT_REQUEST, FORMAT_STATUS, MAX_FRAME_LENGTH, where, whereStr, who
-
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
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description OpenDeviceType
detectDeviceType()
Tries to return aOpenDeviceType
based on frame valueprotected Dim
dimFromValue(int i)
boolean
isOff()
Verify OpenWebNet message if light isOFF
(WHAT=0).boolean
isOn()
Verify OpenWebNet message if light isON
(WHAT=1).static int
levelToPercent(int level)
Transforms a 0-10 level (int) to a percent (0-100)int
parseDimmerLevel100()
Parse dimmerLevel100 (DIM: 1)protected void
parseWhere()
Parse WHERE and assigns it toBaseOpenMessage.where
attributestatic What
percentToWhat(int percent)
Return WHAT corresponding to the brightness percent.static Lighting
requestDimTo(String where, What level)
OpenWebNet message request to dim light to level*1*level*WHERE##
.static Lighting
requestStatus(String where)
OpenWebNet message request light status*#1*WHERE##
.static Lighting
requestTurnOff(String where)
OpenWebNet message request to turn lightOFF
*1*0*WHERE##
.static Lighting
requestTurnOn(String where)
OpenWebNet message request to turn lightON
*1*1*WHERE##
.protected What
whatFromValue(int i)
-
Methods inherited from class org.openwebnet4j.message.BaseOpenMessage
addValues, getCommandParams, getDim, getDimParams, getDimValues, getWhat, getWhere, getWho, isCommand, isCommandTranslation, isDimWriting, parse, toStringVerbose
-
Methods inherited from class org.openwebnet4j.message.OpenMessage
equals, getFrameValue, isACK, isBUSY_NACK, isNACK, toString
-
-
-
-
Field Detail
-
DIMMER_LEVEL_100_OFF
public static final int DIMMER_LEVEL_100_OFF
- See Also:
- Constant Field Values
-
DIMMER_LEVEL_100_MAX
public static final int DIMMER_LEVEL_100_MAX
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Lighting
protected Lighting(String value)
-
-
Method Detail
-
whatFromValue
protected What whatFromValue(int i)
- Specified by:
whatFromValue
in classBaseOpenMessage
-
dimFromValue
protected Dim dimFromValue(int i)
- Specified by:
dimFromValue
in classBaseOpenMessage
-
requestTurnOn
public static Lighting requestTurnOn(String where)
OpenWebNet message request to turn lightON
*1*1*WHERE##
.- Parameters:
where
- WHERE string- Returns:
- message
-
requestTurnOff
public static Lighting requestTurnOff(String where)
OpenWebNet message request to turn lightOFF
*1*0*WHERE##
.- Parameters:
where
- WHERE string- Returns:
- message
-
requestDimTo
public static Lighting requestDimTo(String where, What level)
OpenWebNet message request to dim light to level*1*level*WHERE##
.- Parameters:
where
- WHERE stringlevel
- What level (0=Off, 1=On, 2-10=level, 30=Up one level, 31=Down one level, 32=Toggle). SeeLighting.WHAT
- Returns:
- message
-
requestStatus
public static Lighting requestStatus(String where)
OpenWebNet message request light status*#1*WHERE##
.- Parameters:
where
- WHERE string- Returns:
- message
-
isOn
public boolean isOn()
Verify OpenWebNet message if light isON
(WHAT=1).- Returns:
- true if light is ON
-
isOff
public boolean isOff()
Verify OpenWebNet message if light isOFF
(WHAT=0).- Returns:
- true if light is OFF
-
parseDimmerLevel100
public int parseDimmerLevel100() throws FrameException
Parse dimmerLevel100 (DIM: 1)- Returns:
- corresponding int percentage (0-100)
- Throws:
FrameException
- in case of frame error
-
levelToPercent
public static int levelToPercent(int level)
Transforms a 0-10 level (int) to a percent (0-100)- Parameters:
level
- 0-10- Returns:
- int percent
-
percentToWhat
public static What percentToWhat(int percent)
Return WHAT corresponding to the brightness percent.- Parameters:
percent
- 0-100- Returns:
- What level (2-10) corresponding to percent
-
parseWhere
protected void parseWhere() throws FrameException
Description copied from class:BaseOpenMessage
Parse WHERE and assigns it toBaseOpenMessage.where
attribute- Specified by:
parseWhere
in classBaseOpenMessage
- Throws:
FrameException
- in case of error in frame
-
detectDeviceType
public OpenDeviceType detectDeviceType()
Description copied from class:BaseOpenMessage
Tries to return aOpenDeviceType
based on frame value- Specified by:
detectDeviceType
in classBaseOpenMessage
- Returns:
- recognized device type or null if not device can be recognized
-
-