/// <summary> /// Default metersettings, used after state waiting from host or waiting for metertype from client /// </summary> /// <param name="meterType"></param> /// <param name="client"></param> /// <returns></returns> public static string DefaultMeterSettings(DeviceMeterType meterType, QboxClient client) { var cmd = new BaseParseResult(); switch (meterType) { case DeviceMeterType.Ferraris_Black_Toothed: // Set calibration to 10 minutes cmd.Write(RequestCalibrateMeter); cmd.Write((byte)10); break; case DeviceMeterType.LED_TypeI: case DeviceMeterType.LED_TypeII: cmd.Write((byte)DeviceSettingType.SensorChannel); cmd.Write((byte)0x03); if (client != QboxClient.None) { cmd.Write((byte)ClientActivityRequest.RequestToRestartClient); cmd.Write((byte)client); } else { cmd.Write(RequestRestart); } break; } return(cmd.GetMessage()); }
public static string WriteMeterType(DeviceMeterType deviceMeterType) { var result = new BaseParseResult(); result.Write((byte)3); var meterType = (byte)deviceMeterType; result.Write(meterType); return(result.GetMessage()); }
/// <summary> /// Check if inMeterType is present in the Qbox topology. /// </summary> public bool IsMeterTypePresent(DeviceMeterType inMeterType) { if (MeterType == inMeterType) { return(true); } foreach (var client in Clients) { if (client.MeterType == inMeterType) { return(true); } } return(false); }
public void TestRetrieve(string qboxSerial, QboxType qboxType, string expectedStorageId, DeviceMeterType expectedMeterType) { // Arrange var retriever = new ConfiguredMiniRetriever(qboxType); // Act Mini mini = retriever.Retrieve(qboxSerial); // Assert Counter generationCounter = mini.Counters.Single((c) => c.CounterId == 1); Assert.That(generationCounter.StorageId, Is.EqualTo(expectedStorageId)); Assert.That(mini.MeterType, Is.EqualTo(expectedMeterType)); }