protected static IEnumerable <FieldParserBase> InitFields() { yield return(new FieldParser <UniqueClientID>(nameof(UniqueClientID), 4, (buffer, start, length) => new UniqueClientID(BitConverter.ToUInt32(buffer, start)))); yield return(new FieldParser <string>(nameof(Name), 32, (b, s, l) => Encoding.ASCII.GetString(b, s, l))); yield return(new FieldParser <float>(nameof(Latitude), 4, (b, s, l) => BitConverter.ToSingle(b, s))); yield return(new FieldParser <float>(nameof(Longitude), 4, (b, s, l) => BitConverter.ToSingle(b, s))); yield return(new FieldParser <bool>(nameof(AutoUnlatch), 1, (b, s, l) => b[s] != 0)); yield return(new FieldParser <bool>(nameof(PairingEnabled), 1, (b, s, l) => b[s] != 0)); yield return(new FieldParser <bool>(nameof(ButtonEnabled), 1, (b, s, l) => b[s] != 0)); yield return(new FieldParser <bool>(nameof(LEDEnabled), 1, (b, s, l) => b[s] != 0)); yield return(new FieldParser <byte>(nameof(LEDBrightness), 1, (b, s, l) => b[s])); yield return(new FieldParser <NukiTimeStamp>(nameof(CurrentTime), 7, (b, s, l) => NukiTimeStamp.FromBytes(b, s))); yield return(new FieldParser <Int16>(nameof(UTCOffset), 2, (b, s, l) => BitConverter.ToInt16(b, s))); yield return(new FieldParser <NukiDSTSetting>(nameof(DSTMode), 1, (b, s, l) => (NukiDSTSetting)b[s])); yield return(new FieldParser <bool>(nameof(HasFob), 1, (b, s, l) => b[s] != 0)); yield return(new FieldParser <NukiFobAction>(nameof(FobAction1), 1, (b, s, l) => (NukiFobAction)b[s])); yield return(new FieldParser <NukiFobAction>(nameof(FobAction2), 1, (b, s, l) => (NukiFobAction)b[s])); yield return(new FieldParser <NukiFobAction>(nameof(FobAction3), 1, (b, s, l) => (NukiFobAction)b[s])); }
protected static IEnumerable <FieldParserBase> InitFields() { yield return(new FieldParser <NukiState>(nameof(NukiState), 1, (b, s, l) => (NukiState)b[s])); yield return(new FieldParser <NukiLockState>(nameof(LockState), 1, (b, s, l) => (NukiLockState)b[s])); yield return(new FieldParser <NukiLockStateChangeTrigger>(nameof(Trigger), 1, (b, s, l) => (NukiLockStateChangeTrigger)b[s])); yield return(new FieldParser <NukiTimeStamp>(nameof(CurrentTime), 7, (b, s, l) => NukiTimeStamp.FromBytes(b, s))); yield return(new FieldParser <Int16>(nameof(UTCOffset), 2, (b, s, l) => BitConverter.ToInt16(b, s))); yield return(new FieldParser <bool>(nameof(CriticalBattery), 1, (b, s, l) => b[s] != 0)); }
private static IEnumerable <FieldParserBase> CreateFields() { yield return(new FieldParser <ushort>(nameof(Index), sizeof(ushort), (buffer, start, length) => BitConverter.ToUInt16(buffer, start))); yield return(new FieldParser <NukiTimeStamp>(nameof(Timestamp), 7, (buffer, start, length) => NukiTimeStamp.FromBytes(buffer, start))); yield return(new FieldParser <string>(nameof(Name), 32, (buffer, start, length) => Encoding.ASCII.GetString(buffer, start, length))); yield return(new FieldParser <byte>(nameof(Type), 1, (buffer, start, length) => buffer[start])); yield return(new FieldParser <NukiLockAction>(nameof(LockAction), 1, (buffer, start, length) => (NukiLockAction)buffer[start])); yield return(new FieldParser <NukiLockStateChangeTrigger>(nameof(Trigger), 1, (buffer, start, length) => (NukiLockStateChangeTrigger)buffer[start])); yield return(new FieldParser <NukiLockActionFlags>(nameof(Flags), 1, (buffer, start, length) => (NukiLockActionFlags)buffer[start])); }