| /******************************************************************************* |
| * Copyright (c) 2014, 2016 Orange. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License 2.0 |
| * which accompanies this distribution, and is available at |
| * https://www.eclipse.org/legal/epl-2.0/ |
| *******************************************************************************/ |
| package org.eclipse.om2m.sdt.home.devices; |
| |
| import org.eclipse.om2m.sdt.Domain; |
| import org.eclipse.om2m.sdt.Module; |
| import org.eclipse.om2m.sdt.Property; |
| import org.eclipse.om2m.sdt.home.modules.BinarySwitch; |
| import org.eclipse.om2m.sdt.home.modules.Clock; |
| import org.eclipse.om2m.sdt.home.modules.EnergyConsumption; |
| import org.eclipse.om2m.sdt.home.modules.EnergyGeneration; |
| import org.eclipse.om2m.sdt.home.modules.FaultDetection; |
| import org.eclipse.om2m.sdt.home.modules.RunState; |
| import org.eclipse.om2m.sdt.home.types.DeviceType; |
| import org.eclipse.om2m.sdt.home.types.PropertyType; |
| import org.eclipse.om2m.sdt.types.SimpleType; |
| |
| public class SmartElectricMeter extends GenericDevice { |
| |
| private BinarySwitch binarySwitch; |
| private EnergyConsumption energyConsumption; |
| private FaultDetection faultDetection; |
| private RunState runState; |
| private Clock clock; |
| private EnergyGeneration generationMeter; |
| |
| private Property measuringScope; |
| |
| public SmartElectricMeter(final String id, final String serial, final Domain domain) { |
| super(id, serial, DeviceType.deviceSmartElectricMeter, domain); |
| |
| measuringScope = new Property(PropertyType.measuringScope); |
| measuringScope.setType(SimpleType.String); |
| measuringScope.setOptional(true); |
| measuringScope.setDoc("Measuring scope of the meter (ex. Whole house, room, or device)"); |
| addProperty(measuringScope); |
| } |
| |
| public void addModule(Module module) { |
| if (module instanceof FaultDetection) |
| addModule((FaultDetection)module); |
| else if (module instanceof EnergyConsumption) |
| addModule((EnergyConsumption)module); |
| else if (module instanceof BinarySwitch) |
| addModule((BinarySwitch)module); |
| else if (module instanceof RunState) |
| addModule((RunState)module); |
| else if (module instanceof Clock) |
| addModule((Clock)module); |
| else if (module instanceof EnergyGeneration) |
| addModule((EnergyGeneration)module); |
| else |
| super.addModule(module); |
| } |
| |
| public void addModule(BinarySwitch binarySwitch) { |
| this.binarySwitch = binarySwitch; |
| super.addModule(binarySwitch); |
| } |
| |
| public void addModule(EnergyConsumption energyConsumption) { |
| this.energyConsumption = energyConsumption; |
| super.addModule(energyConsumption); |
| } |
| |
| public void addModule(FaultDetection faultDetection) { |
| this.faultDetection = faultDetection; |
| super.addModule(faultDetection); |
| } |
| |
| public void addModule(RunState runState) { |
| this.runState = runState; |
| super.addModule(runState); |
| } |
| |
| public void addModule(Clock clock) { |
| this.clock = clock; |
| super.addModule(clock); |
| } |
| |
| public void addModule(EnergyGeneration generationMeter) { |
| this.generationMeter = generationMeter; |
| super.addModule(generationMeter); |
| } |
| |
| public EnergyConsumption getEnergyConsumption() { |
| return energyConsumption; |
| } |
| |
| public FaultDetection getFaultDetection() { |
| return faultDetection; |
| } |
| |
| public BinarySwitch getBinarySwitch() { |
| return binarySwitch; |
| } |
| |
| public RunState getRunState() { |
| return runState; |
| } |
| |
| public Clock getClock() { |
| return clock; |
| } |
| |
| public EnergyGeneration getGenerationMeter() { |
| return generationMeter; |
| } |
| |
| } |