private static async Task SendEventMessageAsync(GattDeviceService service, WifiEventId wifiEventType)
        {
            Debug.WriteLine($"Sending Wi-Fi config message protocol event: '{wifiEventType}'");

            byte[] eventMessage = MessageProtocolFactory.CreateEventMessage(wifiEventType);
            await BluetoothLeHelper.WriteAsync(eventMessage, service, MessageProtocolRxCharacteristicId);
        }
        public static byte[] CreateEventMessage(WifiEventId wifiEventType)
        {
            /* Event format:
             *
             *  | Offset Bytes |    0     |    1     |    2     |    3     |
             *  |       0      |                  Preamble                 |
             *  |       4      |        Length       | Msg Type | Reserved |
             *  |       8      |      Category ID    |      Event ID       |
             *
             * Length           : UINT16 (LSB) - the message length excluding the first 6 bytes.
             */

            byte[] message = new byte[12];

            ByteArrayHelper.WriteBytes(Preamble, message);
            ByteArrayHelper.WriteLsbUInt16(6, message, 4); // Length
            message[6] = (byte)MessageType.Event;
            ByteArrayHelper.WriteLsbUInt16((ushort)CategoryId.WifiControl, message, 8);
            ByteArrayHelper.WriteLsbUInt16((ushort)wifiEventType, message, 10);

            return(message);
        }