package uk.org.floop.msc.wview object VALUE_TYPE extends Enumeration { val FLOAT, USHORT, TIME_T, SHORT, UCHAR = Value def sizeof(t: Value): Int = t match { case VALUE_TYPE.FLOAT => 4 case VALUE_TYPE.USHORT => 2 case VALUE_TYPE.TIME_T => 4 case VALUE_TYPE.SHORT => 2 case VALUE_TYPE.UCHAR => 1 } } object LoopPacket { val fields = List( (VALUE_TYPE.FLOAT, "barometer"), // inches (VALUE_TYPE.FLOAT, "stationPressure"), // inches (VALUE_TYPE.FLOAT, "altimeter"), // inches (VALUE_TYPE.FLOAT, "inTemp"), // degrees F (VALUE_TYPE.FLOAT, "outTemp"), // degrees F (VALUE_TYPE.USHORT, "inHumidity"), // percent (VALUE_TYPE.USHORT, "outHumidity"), // percent (VALUE_TYPE.USHORT, "windSpeed"), // mph (VALUE_TYPE.USHORT, "windDir"), // degrees (VALUE_TYPE.USHORT, "windGust"), // mph (VALUE_TYPE.USHORT, "windGustDir"), // degrees (VALUE_TYPE.FLOAT, "rainRate"), // in/hr (VALUE_TYPE.FLOAT, "sampleRain"), // inches (VALUE_TYPE.FLOAT, "sampleET"), // ET (VALUE_TYPE.USHORT, "radiation"), // watts/m^3 (VALUE_TYPE.USHORT, "UV"), // UV index * 10 (VALUE_TYPE.FLOAT, "dewpoint"), // degrees F (VALUE_TYPE.FLOAT, "windchill"), // degrees F (VALUE_TYPE.FLOAT, "heatindex"), // degrees F // computed values - station should not alter these (VALUE_TYPE.FLOAT, "stormRain"), // inches (VALUE_TYPE.TIME_T, "stormStart"), // time_t (VALUE_TYPE.FLOAT, "dayRain"), // inches (VALUE_TYPE.FLOAT, "monthRain"), // inches (VALUE_TYPE.FLOAT, "yearRain"), // inches (VALUE_TYPE.FLOAT, "dayET"), // inches (VALUE_TYPE.FLOAT, "monthET"), // inches (VALUE_TYPE.FLOAT, "yearET"), // inches (VALUE_TYPE.FLOAT, "intervalAvgWCHILL"), // degrees F (VALUE_TYPE.SHORT, "intervalAvgWSPEED"), // mph (VALUE_TYPE.USHORT, "yearRainMonth"), // 1-12 Rain Start Month // --- The following may or may not be supported for a given station --- // Vantage Pro (VALUE_TYPE.USHORT, "rxCheckPercent"), // 0 - 100 (VALUE_TYPE.USHORT, "tenMinuteAvgWindSpeed"), // mph (VALUE_TYPE.USHORT, "forecastIcon"), // VP only (VALUE_TYPE.USHORT, "forecastRule"), // VP only (VALUE_TYPE.USHORT, "txBatteryStatus"), // VP only (VALUE_TYPE.USHORT, "consBatteryVoltage"), // VP only (VALUE_TYPE.UCHAR, "extraTemp1"), // degrees F + 90 (VALUE_TYPE.UCHAR, "extraTemp2"), // degrees F + 90 (VALUE_TYPE.UCHAR, "extraTemp3"), // degrees F + 90 (VALUE_TYPE.UCHAR, "soilTemp1"), // degrees F + 90 (VALUE_TYPE.UCHAR, "soilTemp2"), // degrees F + 90 (VALUE_TYPE.UCHAR, "soilTemp3"), // degrees F + 90 (VALUE_TYPE.UCHAR, "soilTemp4"), // degrees F + 90 (VALUE_TYPE.UCHAR, "leafTemp1"), // degrees F + 90 (VALUE_TYPE.UCHAR, "leafTemp2"), // degrees F + 90 (VALUE_TYPE.UCHAR, "extraHumid1"), // percent (VALUE_TYPE.UCHAR, "extraHumid2"), // percent (VALUE_TYPE.UCHAR, "soilMoist1"), (VALUE_TYPE.UCHAR, "soilMoist2"), (VALUE_TYPE.UCHAR, "leafWet1"), (VALUE_TYPE.UCHAR, "leafWet2"), (VALUE_TYPE.UCHAR, "pad1"), // Vaisala WXT-510 (VALUE_TYPE.FLOAT, "wxt510Hail"), // inches (VALUE_TYPE.FLOAT, "wxt510Hailrate"), // in/hr (VALUE_TYPE.FLOAT, "wxt510HeatingTemp"), // degrees F (VALUE_TYPE.FLOAT, "wxt510HeatingVoltage"), // volts (VALUE_TYPE.FLOAT, "wxt510SupplyVoltage"), // volts (VALUE_TYPE.FLOAT, "wxt510ReferenceVoltage") // volts ) val START_FRAME = Array(0xf3, 0x88, 0xc6, 0xa2, 0xda, 0xda, 0xe7, 0xcf).map(_.toByte) }