当前位置: 首页>>代码示例>>Java>>正文


Java UnitProperties类代码示例

本文整理汇总了Java中com.digitaldan.jomnilinkII.MessageTypes.properties.UnitProperties的典型用法代码示例。如果您正苦于以下问题:Java UnitProperties类的具体用法?Java UnitProperties怎么用?Java UnitProperties使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


UnitProperties类属于com.digitaldan.jomnilinkII.MessageTypes.properties包,在下文中一共展示了UnitProperties类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: readUnitProperties

import com.digitaldan.jomnilinkII.MessageTypes.properties.UnitProperties; //导入依赖的package包/类
/**
 * Iterate through the system units (lights)
 * @param number of the unti
 * @return UnitProperties of unit, null if not found
 * @throws IOException
 * @throws OmniNotConnectedException
 * @throws OmniInvalidResponseException
 * @throws OmniUnknownMessageTypeException
 */
private UnitProperties readUnitProperties(int number)
		throws IOException, OmniNotConnectedException,
		OmniInvalidResponseException, OmniUnknownMessageTypeException {
	Message m = c.reqObjectProperties(Message.OBJ_TYPE_UNIT, number, 0,
			ObjectProperties.FILTER_1_NAMED,
			ObjectProperties.FILTER_2_AREA_ALL,
			ObjectProperties.FILTER_3_ANY_LOAD);
	if (m.getMessageType() == Message.MESG_TYPE_OBJ_PROP) {
		return ((UnitProperties) m);
	}
	return null;
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:22,代码来源:OmniLinkBinding.java

示例2: Unit

import com.digitaldan.jomnilinkII.MessageTypes.properties.UnitProperties; //导入依赖的package包/类
public Unit(UnitProperties properties) {
	this.properties = properties;
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:4,代码来源:Unit.java

示例3: getProperties

import com.digitaldan.jomnilinkII.MessageTypes.properties.UnitProperties; //导入依赖的package包/类
@Override
public UnitProperties getProperties() {
	return properties;
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:5,代码来源:Unit.java

示例4: setProperties

import com.digitaldan.jomnilinkII.MessageTypes.properties.UnitProperties; //导入依赖的package包/类
public void setProperties(UnitProperties properties) {
	this.properties = properties;
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:4,代码来源:Unit.java

示例5: generateUnits

import com.digitaldan.jomnilinkII.MessageTypes.properties.UnitProperties; //导入依赖的package包/类
/**
 * This is by far the most complex method as units have the ability to be
 * sub-grouped into rooms.  If units are in a room then they will be added to
 * their own group which is a member of the Lights group.  
 * @throws IOException
 * @throws OmniNotConnectedException
 * @throws OmniInvalidResponseException
 * @throws OmniUnknownMessageTypeException
 */
private void generateUnits() throws IOException, OmniNotConnectedException, OmniInvalidResponseException, OmniUnknownMessageTypeException{

	//Group	Lights_GreatRoom	"Great Room"	(Lights)
	String groupString = "Group\t%s\t\"%s\"\t(%s)\n";

	//Dimmer	Lights_GreatRoom_MainLights_Switch	"Main Lights [%d%%]"	(Lights_GreatRoom)	{omnilink="unit:10"}
	String itemString = "%s\t%s\t\"%s\"\t(%s)\t{omnilink=\"unit:%d\"}\n";

	String groupName = "Lights";

	//Group	Lights	"Lights"	(All)
	groups.append(String.format(groupString,groupName,"Lights","All"));

	int objnum = 0;
	Message m;
	int currentRoom = 0;
	String currentRoomName = null;

	while ((m = c.reqObjectProperties(Message.OBJ_TYPE_UNIT, objnum, 1, ObjectProperties.FILTER_1_NAMED,
			ObjectProperties.FILTER_2_AREA_ALL, ObjectProperties.FILTER_3_ANY_LOAD)).getMessageType() == Message.MESG_TYPE_OBJ_PROP) {
		UnitProperties o = ((UnitProperties) m);
		objnum = o.getNumber();

		boolean isInRoom = false;
		boolean isRoomController = false;
		if(o.getUnitType() == UnitProperties.UNIT_TYPE_HLC_ROOM || 
				o.getObjectType() == UnitProperties.UNIT_TYPE_VIZIARF_ROOM){
			currentRoom = objnum;

			//Lights_LivingRoom
			currentRoomName = cleanString(groupName + "_" + o.getName());

			//Make Sure we don't already have a group called this
			currentRoomName = addUniqueGroup(currentRoomName);

			groups.append(String.format(groupString,currentRoomName,o.getName(),groupName));
			rooms.put(currentRoomName, new LinkedList<SiteItem>());
			isInRoom = true;
			isRoomController = true;
		} else if(objnum < currentRoom + 8){
			isInRoom = true;
		}

		//clean the name to remove things like spaces
		String objName = cleanString(o.getName());

		String group = isInRoom ? currentRoomName : groupName;

		//name will be the room name for the first device and roomName_deviceName for sub devices
		String name = isRoomController ? objName : group + "_" + objName;

		//the label does not have to be cleaned, so set it from the object
		String label = o.getName() + " [%d%%]";

		SiteItem light  = new SiteItem(name, o.getName(), label);

		items.append(String.format(itemString,"Dimmer",name + "_Switch",label,group,objnum));


		if(isRoomController)
			items.append(String.format(itemString,"String",name + "_String",o.getName() + " [%s]",group,objnum));

		if(isInRoom)
			rooms.get(currentRoomName).add(light);
		else
			lights.add(light);

	}
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:79,代码来源:OmnilinkItemGenerator.java

示例6: Unit

import com.digitaldan.jomnilinkII.MessageTypes.properties.UnitProperties; //导入依赖的package包/类
public Unit(UnitProperties properties) {
    this.properties = properties;
}
 
开发者ID:openhab,项目名称:openhab1-addons,代码行数:4,代码来源:Unit.java

示例7: getProperties

import com.digitaldan.jomnilinkII.MessageTypes.properties.UnitProperties; //导入依赖的package包/类
@Override
public UnitProperties getProperties() {
    return properties;
}
 
开发者ID:openhab,项目名称:openhab1-addons,代码行数:5,代码来源:Unit.java

示例8: setProperties

import com.digitaldan.jomnilinkII.MessageTypes.properties.UnitProperties; //导入依赖的package包/类
public void setProperties(UnitProperties properties) {
    this.properties = properties;
}
 
开发者ID:openhab,项目名称:openhab1-addons,代码行数:4,代码来源:Unit.java

示例9: readUnitProperties

import com.digitaldan.jomnilinkII.MessageTypes.properties.UnitProperties; //导入依赖的package包/类
/**
 * Iterate through the system units (lights)
 *
 * @param number of the unti
 * @return UnitProperties of unit, null if not found
 * @throws IOException
 * @throws OmniNotConnectedException
 * @throws OmniInvalidResponseException
 * @throws OmniUnknownMessageTypeException
 */
private UnitProperties readUnitProperties(int number) throws IOException, OmniNotConnectedException,
        OmniInvalidResponseException, OmniUnknownMessageTypeException {
    Message m = c.reqObjectProperties(Message.OBJ_TYPE_UNIT, number, 0, ObjectProperties.FILTER_1_NAMED,
            ObjectProperties.FILTER_2_AREA_ALL, ObjectProperties.FILTER_3_ANY_LOAD);
    if (m.getMessageType() == Message.MESG_TYPE_OBJ_PROP) {
        return ((UnitProperties) m);
    }
    return null;
}
 
开发者ID:openhab,项目名称:openhab1-addons,代码行数:20,代码来源:OmniLinkBinding.java


注:本文中的com.digitaldan.jomnilinkII.MessageTypes.properties.UnitProperties类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。