📄 upnpstatevariable.java
字号:
package no.auc.one.portableplayer.communication.upnphosting;
// XXX Needs more get+set methods and ctors...
/**
* State variable for a UPnP Service.
*
*/
public class UPnPStateVariable {
/**
* If the state variable is evented or not.
*
* Default value from the UPnP Device Architecture
*/
private boolean isEvented = true;
private int dataType;
/**
* Name of the State Variable.
*
*
* For standard variables defined by a UPnP Forum working committee, must not
* begin with X_ nor A_.
* For non-standard variables specified by a UPnP vendor and added to a
* standard service, must begin with X_. Should be < 32 characters.
*/
private String name;
/**
* Default value.
*
* Expected, initial value. Defined by a UPnP Forum working committee or
* delegated to UPnP vendor. Must match data type. Must satisfy
* allowedValueList or allowedValueRange constraints.
*/
private Object defaultValue = null;
/**
* Enumerates legal string values.
*
* Prohibited for data types other than string. Each element of the list
* should be < 32 characters.
*/
private String[] allowedValueList;
/**
* Defines bounds for legal numeric values; defines resolution for numeric
* values.
*
* Defined only for numeric data types.
*/
private UPnPValueRange allowedValueRange;
public UPnPStateVariable(String name, int dataType) {
this.dataType = dataType;
this.name = name;
}
public UPnPStateVariable(String name, int dataType, boolean isEvented) {
this.dataType = dataType;
this.isEvented = isEvented;
this.name = name;
}
public UPnPStateVariable(String name, int dataType, boolean isEvented, String[] allowedValueList) {
this.dataType = dataType;
this.isEvented = isEvented;
this.name = name;
this.allowedValueList = allowedValueList;
}
public UPnPStateVariable(String name, int dataType, boolean isEvented, UPnPValueRange range) {
this.dataType = dataType;
this.isEvented = isEvented;
this.name = name;
this.allowedValueRange = range;
}
public UPnPStateVariable(String name, int dataType, Object defaultValue) {
this.dataType = dataType;
this.defaultValue = defaultValue;
this.name = name;
}
public UPnPStateVariable(
String name,
int dataType,
Object defaultValue,
boolean isEvented)
{
this.name = name;
this.dataType = dataType;
this.isEvented = isEvented;
this.defaultValue = defaultValue;
}
public boolean isEvented() {
return isEvented;
}
public String getName() {
return name;
}
public int getDataType() {
return dataType;
}
public Object getDefaultValue() {
return defaultValue;
}
public String[] getAllowedValueList() {
return allowedValueList;
}
public UPnPValueRange getAllowedValueRange() {
return allowedValueRange;
}
/**************************************************************************
*
* State Variable Datatype Constants
*
*************************************************************************/
/**
* Unsigned 1 Byte int. Same format as int without leading sign.
*/
public final static int STATEVARIABLE_DATATYPE_UI1 = 0;
/**
* Unsigned 2 Byte int. Same format as int without leading sign.
*/
public final static int STATEVARIABLE_DATATYPE_UI2 = 1;
/**
* Unsigned 4 Byte int. Same format as int without leading sign.
*/
public final static int STATEVARIABLE_DATATYPE_UI4 = 2;
/**
* 1 Byte int. Same format as int.
*/
public final static int STATEVARIABLE_DATATYPE_I1 = 3;
/**
* 2 Byte int. Same format as int.
*/
public final static int STATEVARIABLE_DATATYPE_I2 = 4;
/**
* 4 Byte int. Same format as int. Must be between -2147483648 and
* 2147483647.
*/
public final static int STATEVARIABLE_DATATYPE_I4 = 5;
/**
* Fixed point, integer number. May have leading sign. May have leading
* zeros. (No currency symbol.) (No grouping of digits to the left of the
* decimal, e.g., no commas.)
*/
public final static int STATEVARIABLE_DATATYPE_INT = 6;
/**
* 4 Byte float. Same format as float. Must be between 3.40282347E+38 to
* 1.17549435E-38.
*/
public final static int STATEVARIABLE_DATATYPE_R4 = 7;
/**
* 8 Byte float. Same format as float. Must be between
* -1.79769313486232E308 and -4.94065645841247E-324 for negative values,
* and between 4.94065645841247E-324 and 1.79769313486232E308 for
* positive values, i.e., IEEE 64-bit (8-Byte) double.
*/
public final static int STATEVARIABLE_DATATYPE_R8 = 8;
/**
* Same as r8 but no more than 14 digits to the left of the decimal point
* and no more than 4 to the right.
*/
public final static int STATEVARIABLE_DATATYPE_FIXED_144 = 9;
/**
* Floating point number. Mantissa (left of the decimal) and/or exponent
* may have a leading sign. Mantissa and/or exponent may have leading
* zeros. Decimal character in mantissa is a period, i.e., whole digits in
* mantissa separated from fractional digits by period. Mantissa separated
* from exponent by E. (No currency symbol.) (No grouping of digits in the
* mantissa, e.g., no commas.)
*/
public final static int STATEVARIABLE_DATATYPE_FLOAT = 10;
/**
* Unicode string. One character long.
*/
public final static int STATEVARIABLE_DATATYPE_CHAR = 11;
/**
* Unicode string. No limit on length.
*/
public final static int STATEVARIABLE_DATATYPE_STRING = 12;
/**
* Date in a subset of ISO 8601 format without time data.
*/
public final static int STATEVARIABLE_DATATYPE_DATE = 13;
/**
* Date in ISO 8601 format with optional time but no time zone.
*/
public final static int STATEVARIABLE_DATATYPE_DATETIME = 14;
/**
* Date in ISO 8601 format with optional time and optional time zone.
*/
public final static int STATEVARIABLE_DATATYPE_DATETIME_TZ = 15;
/**
* Time in a subset of ISO 8601 format with no date and no time zone.
*/
public final static int STATEVARIABLE_DATATYPE_TIME = 16;
/**
* Time in a subset of ISO 8601 format with optional time zone but no date.
*/
public final static int STATEVARIABLE_DATATYPE_TIME_TZ = 17;
/**
* Boolean value.
*/
public final static int STATEVARIABLE_DATATYPE_BOOLEAN = 18;
/**
* MIME-style Base64 encoded binary BLOB.
*
* Takes 3 Bytes, splits them into 4 parts, and maps each 6 bit piece to
* an octet. (3 octets are encoded as 4.) No limit on size.
*/
public final static int STATEVARIABLE_DATATYPE_BIN_BASE64 = 19;
/**
* Hexadecimal digits representing octets.
*
* Treats each nibble as a hex digit and encodes as a separate Byte. (1
* octet is encoded as 2.) No limit on size.
*/
public final static int STATEVARIABLE_DATATYPE_BIN_HEX = 20;
/**
* Universal Resource Identifier.
*/
public final static int STATEVARIABLE_DATATYPE_URI = 21;
/**
* Universally Unique ID.
*
* Hexadecimal digits representing octets. Optional embedded hyphens are
* ignored.
*/
public final static int STATEVARIABLE_DATATYPE_UUID = 22;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -