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


Java EventPublisher类代码示例

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


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

示例1: setBindingData

import org.openhab.core.events.EventPublisher; //导入依赖的package包/类
/**
 * Set binding data for internal use and port item state init
 *
 * @param eventPublisher
 * @param itemsInfoConfig
 * @param deviceName
 */
public void setBindingData(EventPublisher eventPublisher, Map<String, SimaticInfoBindingConfig> itemsInfoConfig,
        String deviceName) {
    this.eventPublisher = eventPublisher;

    for (Map.Entry<String, SimaticInfoBindingConfig> item : itemsInfoConfig.entrySet()) {

        if (item.getValue().device.equals(deviceName)) {
            // find right info type
            if (item.getValue().infoType == InfoType.STATE) {
                itemState = item.getValue().item.getName();
            } else if (item.getValue().infoType == InfoType.PREVIOUS_STATE) {
                itemPreviousState = item.getValue().item.getName();
            } else if (item.getValue().infoType == InfoType.STATE_CHANGE_TIME) {
                itemStateChangeTime = item.getValue().item.getName();
            }
        }
    }
}
 
开发者ID:docbender,项目名称:openHAB-Simatic,代码行数:26,代码来源:SimaticPortState.java

示例2: setBindingData

import org.openhab.core.events.EventPublisher; //导入依赖的package包/类
/**
 * Method to set binding configuration
 *
 * @param eventPublisher
 * @param itemsConfig
 * @param itemsInfoConfig
 */
@Override
public void setBindingData(EventPublisher eventPublisher, Map<String, SimaticBindingConfig> itemsConfig,
        Map<String, SimaticInfoBindingConfig> itemsInfoConfig) {
    this.eventPublisher = eventPublisher;

    // device item list
    List<Map.Entry<String, SimaticBindingConfig>> list = new LinkedList<Map.Entry<String, SimaticBindingConfig>>();

    for (Map.Entry<String, SimaticBindingConfig> item : itemsConfig.entrySet()) {
        if (item.getValue().device.equals(this.deviceName)) {
            list.add(item);
        }
    }

    // sort by address
    Collections.sort(list, new Comparator<Map.Entry<String, SimaticBindingConfig>>() {
        @Override
        public int compare(Map.Entry<String, SimaticBindingConfig> o1, Map.Entry<String, SimaticBindingConfig> o2) {
            return (o1.getValue().address).compareTo(o2.getValue().address);
        }
    });

    Map<String, SimaticBindingConfig> deviceItems = new LinkedHashMap<String, SimaticBindingConfig>();
    for (Map.Entry<String, SimaticBindingConfig> entry : list) {
        deviceItems.put(entry.getKey(), entry.getValue());
    }

    this.itemsConfig = deviceItems;

    this.portState.setBindingData(eventPublisher, itemsInfoConfig, this.deviceName);
}
 
开发者ID:docbender,项目名称:openHAB-Simatic,代码行数:39,代码来源:SimaticGenericDevice.java

示例3: start

import org.openhab.core.events.EventPublisher; //导入依赖的package包/类
public void start(BundleContext bundleContext) throws Exception {
	CompatibilityActivator.context = bundleContext;

	itemRegistryTracker = new ServiceTracker<ItemRegistry, ItemRegistry>(bundleContext, ItemRegistry.class, null);
	itemRegistryTracker.open();

	eventPublisherTracker = new ServiceTracker<EventPublisher, EventPublisher>(bundleContext, EventPublisher.class, null);
	eventPublisherTracker.open();

	scriptEngineTracker = new ServiceTracker<ScriptEngine, ScriptEngine>(bundleContext, ScriptEngine.class, null);
	scriptEngineTracker.open();
}
 
开发者ID:Neulinet,项目名称:Zoo,代码行数:13,代码来源:CompatibilityActivator.java

示例4: StandardProfile

import org.openhab.core.events.EventPublisher; //导入依赖的package包/类
public StandardProfile(Item item, EventPublisher eventPublisher) {
    super(item, eventPublisher);
    converterFactory.addStateConverter(Parameter.TEMPERATURE.name(), DecimalType.class, TemperatureNumberWithUnitConverter.class);
    converterFactory.addStateConverter(Parameter.HUMIDITY.name(), PercentType.class, HumidityConverter.class);
    converterFactory.addStateConverter(Parameter.CO2_CONCENTRATION.name(), DecimalType.class, PPMConverter.class);
    converterFactory.addStateConverter(Parameter.VOC_CONCENTRATION.name(), DecimalType.class, PPBConverter.class);
    converterFactory.addStateConverter(Parameter.ILLUMINANCE.name(), DecimalType.class, IlluminationConverter.class);
    converterFactory.addStateConverter(Parameter.MOVEMENT.name(), OnOffType.class, OnOffStateConverter.class);
    converterFactory.addStateConverter(Parameter.SUPPLY_VOLTAGE.name(), DecimalType.class, VoltageConverter.class);
    converterFactory.addStateConverter(Parameter.POWER.name(), DecimalType.class, PowerConverter.class);
    converterFactory.addStateConverter(Parameter.I.name(), OnOffType.class, ButtonStateConverter.class);
    converterFactory.addStateConverter(Parameter.O.name(), OnOffType.class, ButtonStateConverter.class);
    converterFactory.addStateConverter(Parameter.CONTACT_STATE.name(), OpenClosedType.class, ContactStateConverter.class);
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:15,代码来源:StandardProfile.java

示例5: setEventPublisher

import org.openhab.core.events.EventPublisher; //导入依赖的package包/类
public void setEventPublisher(EventPublisher eventPublisher) {
	this.eventPublisher = eventPublisher;

	for(SerialDevice serialDevice : serialDevices.values()) {
		serialDevice.setEventPublisher(eventPublisher);
	}
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:8,代码来源:OceanicBinding.java

示例6: unsetEventPublisher

import org.openhab.core.events.EventPublisher; //导入依赖的package包/类
public void unsetEventPublisher(EventPublisher eventPublisher) {
	this.eventPublisher = null;

	for(SerialDevice serialDevice : serialDevices.values()) {
		serialDevice.setEventPublisher(null);
	}
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:8,代码来源:OceanicBinding.java

示例7: sendCommand

import org.openhab.core.events.EventPublisher; //导入依赖的package包/类
/**
 * Sends a command for a specified item to the event bus.
 * 
 * @param item the item to send the command to
 * @param command the command to send
 */
static public Object sendCommand(Item item, Command command) {
	EventPublisher publisher = (EventPublisher) ScriptActivator.eventPublisherTracker.getService();
	if (publisher!=null && item != null) {
		publisher.sendCommand(item.getName(), command);
	}
	return null;
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:14,代码来源:BusEvent.java

示例8: ZWaveBinarySensorConverter

import org.openhab.core.events.EventPublisher; //导入依赖的package包/类
/**
 * Constructor. Creates a new instance of the {@link ZWaveBinarySensorConverter} class.
 * @param controller the {@link ZWaveController} to use for sending messages.
 * @param eventPublisher the {@link EventPublisher} to use to publish events.
 */
public ZWaveBinarySensorConverter(ZWaveController controller, EventPublisher eventPublisher) {
	super(controller, eventPublisher);
	
	// State and commmand converters used by this converter. 
	this.addStateConverter(new BinaryDecimalTypeConverter());
	this.addStateConverter(new BinaryPercentTypeConverter());
	this.addStateConverter(new IntegerOnOffTypeConverter());
	this.addStateConverter(new IntegerOpenClosedTypeConverter());
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:15,代码来源:ZWaveBinarySensorConverter.java

示例9: ZWaveAlarmSensorConverter

import org.openhab.core.events.EventPublisher; //导入依赖的package包/类
/**
 * Constructor. Creates a new instance of the {@link ZWaveAlarmSensorConverter} class.
 * @param controller the {@link ZWaveController} to use for sending messages.
 * @param eventPublisher the {@link EventPublisher} to use to publish events.
 */
public ZWaveAlarmSensorConverter(ZWaveController controller, EventPublisher eventPublisher) {
	super(controller, eventPublisher);
	
	// State and commmand converters used by this converter. 
	this.addStateConverter(new IntegerDecimalTypeConverter());
	this.addStateConverter(new IntegerPercentTypeConverter());
	this.addStateConverter(new IntegerOnOffTypeConverter());
	this.addStateConverter(new IntegerOpenClosedTypeConverter());
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:15,代码来源:ZWaveAlarmSensorConverter.java

示例10: ZWaveBatteryConverter

import org.openhab.core.events.EventPublisher; //导入依赖的package包/类
/**
 * Constructor. Creates a new instance of the {@link ZWaveBatteryConverter} class.
 * @param controller the {@link ZWaveController} to use for sending messages.
 * @param eventPublisher the {@link EventPublisher} to use to publish events.
 */
public ZWaveBatteryConverter(ZWaveController controller, EventPublisher eventPublisher) {
	super(controller, eventPublisher);
	
	// State and commmand converters used by this converter. 
	this.addStateConverter(new BatteryDecimalTypeConverter());
	this.addStateConverter(new BatteryPercentTypeConverter());
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:13,代码来源:ZWaveBatteryConverter.java

示例11: ZWaveSceneConverter

import org.openhab.core.events.EventPublisher; //导入依赖的package包/类
/**
 * Constructor. Creates a new instance of the {@link ZWaveConverterBase}
 * class.
 * @param controller the {@link ZWaveController} to use to send messages.
 * @param eventPublisher the {@link EventPublisher} that can be used to send updates.
 */
public ZWaveSceneConverter(ZWaveController controller, EventPublisher eventPublisher) {
	super(controller, eventPublisher);

	// State converters used by this converter.
	this.addStateConverter(new BinaryDecimalTypeConverter());
	this.addStateConverter(new IntegerOnOffTypeConverter());
	this.addStateConverter(new IntegerOpenClosedTypeConverter());
   }
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:15,代码来源:ZWaveSceneConverter.java

示例12: ZWaveMultiLevelSensorConverter

import org.openhab.core.events.EventPublisher; //导入依赖的package包/类
/**
 * Constructor. Creates a new instance of the {@link ZWaveMultiLevelSensorConverter} class.
 * @param controller the {@link ZWaveController} to use for sending messages.
 * @param eventPublisher the {@link EventPublisher} to use to publish events.
 */
public ZWaveMultiLevelSensorConverter(ZWaveController controller, EventPublisher eventPublisher) {
	super(controller, eventPublisher);
	
	// State and commmand converters used by this converter. 
	this.addStateConverter(new BigDecimalDecimalTypeConverter());
	this.addStateConverter(new BigDecimalOnOffTypeConverter());
	this.addStateConverter(new BigDecimalOpenClosedTypeConverter());
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:14,代码来源:ZWaveMultiLevelSensorConverter.java

示例13: ZWaveConfigurationConverter

import org.openhab.core.events.EventPublisher; //导入依赖的package包/类
/**
 * Constructor. Creates a new instance of the {@link ZWaveConfigurationConverter} class.
 * @param controller the {@link ZWaveController} to use for sending messages.
 * @param eventPublisher the {@link EventPublisher} to use to publish events.
 */
public ZWaveConfigurationConverter(ZWaveController controller, EventPublisher eventPublisher) {
	super(controller, eventPublisher);

	// State and commmand converters used by this converter.
	this.addStateConverter(new IntegerDecimalTypeConverter());
	this.addStateConverter(new IntegerPercentTypeConverter());
	this.addStateConverter(new BigDecimalDecimalTypeConverter());

	this.addCommandConverter(new IntegerCommandConverter());
	this.addCommandConverter(new MultiLevelPercentCommandConverter());
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:17,代码来源:ZWaveConfigurationConverter.java

示例14: ZWaveBasicConverter

import org.openhab.core.events.EventPublisher; //导入依赖的package包/类
/**
 * Constructor. Creates a new instance of the {@link ZWaveBasicConverter} class.
 * @param controller the {@link ZWaveController} to use for sending messages.
 * @param eventPublisher the {@link EventPublisher} to use to publish events.
 */
public ZWaveBasicConverter(ZWaveController controller, EventPublisher eventPublisher) {
	super(controller, eventPublisher);

	// State and commmand converters used by this converter. 
	this.addStateConverter(new IntegerDecimalTypeConverter());
	this.addStateConverter(new IntegerPercentTypeConverter());
	this.addStateConverter(new IntegerOnOffTypeConverter());
	this.addStateConverter(new IntegerOpenClosedTypeConverter());
	this.addStateConverter(new BigDecimalDecimalTypeConverter());
	
	this.addCommandConverter(new MultiLevelOnOffCommandConverter());
	this.addCommandConverter(new MultiLevelPercentCommandConverter());
	this.addCommandConverter(new MultiLevelIncreaseDecreaseCommandConverter());
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:20,代码来源:ZWaveBasicConverter.java

示例15: ZWaveMeterConverter

import org.openhab.core.events.EventPublisher; //导入依赖的package包/类
/**
 * Constructor. Creates a new instance of the {@link ZWaveMeterConverter} class.
 * @param controller the {@link ZWaveController} to use for sending messages.
 * @param eventPublisher the {@link EventPublisher} to use to publish events.
 */
public ZWaveMeterConverter(ZWaveController controller, EventPublisher eventPublisher) {
	super(controller, eventPublisher);
	
	// State and commmand converters used by this converter. 
	this.addStateConverter(new BigDecimalDecimalTypeConverter());
	this.addStateConverter(new BigDecimalOnOffTypeConverter());
	this.addStateConverter(new BigDecimalOpenClosedTypeConverter());
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:14,代码来源:ZWaveMeterConverter.java


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