예제 #1
0
파일: Command.cs 프로젝트: CK-Yong/QboxNext
        /// <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());
        }
예제 #2
0
파일: Mini.cs 프로젝트: StefH/QboxNext
        public static string WriteMeterType(DeviceMeterType deviceMeterType)
        {
            var result = new BaseParseResult();

            result.Write((byte)3);
            var meterType = (byte)deviceMeterType;

            result.Write(meterType);
            return(result.GetMessage());
        }
예제 #3
0
파일: Mini.cs 프로젝트: StefH/QboxNext
        /// <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);
        }
예제 #4
0
        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));
        }