1 // 2 // Copyright (c) 2010-2018 Antmicro 3 // 4 // This file is licensed under the MIT License. 5 // Full license text is available in 'licenses/MIT.txt'. 6 // 7 using System; 8 9 namespace Antmicro.Renode.Peripherals.Wireless.IEEE802_15_4 10 { 11 public enum AddressingMode : byte 12 { 13 None = 0x0, 14 Reserved = 0x1, 15 // 2 bytes PAN id, 2 bytes address 16 ShortAddress = 0x2, 17 // 2 bytes PAN, 8 bytes address 18 ExtendedAddress = 0x3 19 } 20 21 public static class AddressingModeExtensions 22 { GetBytesLength(this AddressingMode mode)23 public static int GetBytesLength(this AddressingMode mode) 24 { 25 switch(mode) 26 { 27 case AddressingMode.None: 28 return 0; 29 case AddressingMode.ShortAddress: 30 return 2; 31 case AddressingMode.ExtendedAddress: 32 return 8; 33 default: 34 throw new ArgumentException(); 35 } 36 } 37 } 38 } 39 40