/// <summary>
        /// <see cref="WifiP2pActivity.OnGroupInfoAvailable(WifiP2pGroup)"/>
        /// </summary>
        override public void OnGroupInfoAvailable(WifiP2pGroup group)
        {
            foreach (WifiP2pDevice device in group.ClientList)
            {
                m_Clients.Add(device);
            }

            m_Adapter.NotifyDataSetChanged();
        }
 /// <summary>
 /// <see cref="IGroupInfoListener.OnGroupInfoAvailable(WifiP2pGroup)"/>
 /// </summary>
 abstract public void OnGroupInfoAvailable(WifiP2pGroup group);
 /// <summary>
 /// <see cref="IWifiP2pCallbacksHandler.OnWifiP2pConnectionChanged(NetworkInfo, WifiP2pInfo, WifiP2pGroup)"/>
 /// </summary>
 abstract public void OnWifiP2pConnectionChanged(NetworkInfo networkInfo, WifiP2pInfo p2pInfo, WifiP2pGroup groupInfo);
        /// <summary>
        /// <see cref="IWifiP2pCallbacksHandler.OnWifiP2pConnectionChanged(NetworkInfo, WifiP2pInfo, WifiP2pGroup)"/>
        /// </summary>
        override public void OnWifiP2pConnectionChanged(NetworkInfo networkInfo, WifiP2pInfo p2pInfo, WifiP2pGroup groupInfo)
        {
            base.OnWifiP2pConnectionChanged(networkInfo, p2pInfo, groupInfo);
            if (networkInfo.IsConnected)
            {
                m_Views.SsidTextView.Text = groupInfo.NetworkName;

                foreach (WifiP2pDevice device in groupInfo.ClientList)
                {
                    m_Clients.Add(device);
                }

                m_Adapter.NotifyDataSetChanged();
            }
        }
 /// <summary>
 /// <see cref="IGroupInfoListener.OnGroupInfoAvailable(WifiP2pGroup)"/>
 /// </summary>
 virtual public void OnGroupInfoAvailable(WifiP2pGroup group)
 {
 }
 /// <summary>
 /// <see cref="IWifiP2pCallbacksHandler.OnWifiP2pConnectionChanged(NetworkInfo, WifiP2pInfo, WifiP2pGroup)"/>
 /// </summary>
 virtual public void OnWifiP2pConnectionChanged(NetworkInfo networkInfo, WifiP2pInfo p2pInfo, WifiP2pGroup groupInfo)
 {
     if (networkInfo.IsConnected && p2pInfo.GroupFormed)
     {
         if (p2pInfo.IsGroupOwner)
         {
             IsServer = true;
             AccessPoint.Instance.StartListening(this, p2pInfo.GroupOwnerAddress.HostAddress, 8898);
             foreach (WifiP2pDevice device in groupInfo.ClientList)
             {
                 AccessPoint.Instance.TryAddClient(new DeviceInfo(device.DeviceName, device.DeviceAddress, p2pInfo.GroupOwnerAddress.HostAddress));
             }
         }
         else
         {
             IsServer = false;
             Client.Instance.SetConnected(new DeviceInfo(groupInfo.Owner.DeviceName, groupInfo.Owner.DeviceAddress, p2pInfo.GroupOwnerAddress.HostAddress));
             Client.Instance.StartSending(this, p2pInfo.GroupOwnerAddress.HostAddress, 8898);
         }
     }
     else
     {
         if (IsServer)
         {
             AccessPoint.Instance.StopListening(this);
         }
         else
         {
             Client.Instance.StopSending(this);
         }
     }
 }
        /// <summary>
        /// <see cref="BroadcastReceiver.OnReceive(Context, Intent)"/>
        /// </summary>
        override public void OnReceive(Context context, Intent intent)
        {
            // Filter Messages intents
            if (intent is WifiP2pMessageIntent messageIntent)
            {
                // Load extra data from the intent.
                messageIntent.Load();
                switch (messageIntent.Action)
                {
                case WifiP2pMessageIntent.ActionMessageReceivedProgress:
                    if (messageIntent.IsCompleted)
                    {
                        m_CallbackHandler.OnMessageReceived(messageIntent.Message);
                    }
                    else
                    {
                        m_CallbackHandler.OnMessageReceivedProgressChanged(messageIntent.Message.MessageType, messageIntent.Progress);
                    }
                    break;

                case WifiP2pMessageIntent.ActionMessageSentProgress:
                    if (messageIntent.IsCompleted)
                    {
                        m_CallbackHandler.OnMessageSent(messageIntent.Message);
                    }
                    else
                    {
                        m_CallbackHandler.OnMessageSendingProgressChanged(messageIntent.Message, messageIntent.Progress);
                    }
                    break;
                }
            }
            else
            {
                switch (intent.Action)
                {
                case WifiP2pConnectionChangedAction:
                    NetworkInfo  networkInfo = (NetworkInfo)intent.GetParcelableExtra(ExtraNetworkInfo);
                    WifiP2pInfo  p2pInfo     = (WifiP2pInfo)intent.GetParcelableExtra(ExtraWifiP2pInfo);
                    WifiP2pGroup groupInfo   = (WifiP2pGroup)intent.GetParcelableExtra(ExtraWifiP2pGroup);
                    m_CallbackHandler.OnWifiP2pConnectionChanged(networkInfo, p2pInfo, groupInfo);
                    break;

                case WifiP2pPeersChangedAction:
                    WifiP2pDeviceList peers = (WifiP2pDeviceList)intent.GetParcelableExtra(ExtraP2pDeviceList);
                    m_CallbackHandler.OnPeersAvailable(peers);
                    break;

                case WifiP2pStateChangedAction:
                    EWifiState wifiState = (EWifiState)intent.GetIntExtra(ExtraWifiState, 0);
                    m_CallbackHandler.OnWifiP2pStateChanged(wifiState);
                    break;

                case WifiP2pThisDeviceChangedAction:
                    WifiP2pDevice deviceDetails = (WifiP2pDevice)intent.GetParcelableExtra(ExtraWifiP2pDevice);
                    m_CallbackHandler.OnThisDeviceChanged(deviceDetails);
                    break;

                default:
                    throw new NotSupportedException($"The action {intent.Action} is not handled by this receiver.");
                }
            }
        }