Exemple #1
0
        /// <summary>
        /// Connect to AP with given SSID and Password
        /// </summary>
        /// <param name="pSSID">SSID</param>
        /// <param name="pPassword">Password</param>
        /// <param name="pWLanType">Wireless type</param>
        /// <returns>Return the result of this operation</returns>
        public DeviceActionResult SetAccessPoint(string pSSID, string pPassword, WirelessType pWLanType)
        {
            DeviceActionResult dev_result = new DeviceActionResult();

            //Prepare the command
            string comando = "{\"netif\":{\"set_stainfo\":{\"ssid\":\"{0}\",\"password\":\"{1}\",\"key_type\":{2}}}}";

            comando = Common.StringParams(comando, pSSID, pPassword, Convert.ToString((byte)pWLanType));

            //Send the command to the device and get the Json string result
            string sJsonResult = this.ExecuteAndRead(comando);

            try
            {
                JObject json_object = JObject.Parse(sJsonResult);
                dev_result.LoadFromJson(json_object["netif"]["set_stainfo"]);
            }
            catch (Exception ex)
            {
                throw new NonCompatibleDeviceException(ex.Message, ex);
            }

            return(dev_result);
        }
Exemple #2
0
 public Task <BBoxResult> DisableWirelessAsync(WirelessType wirelessType) => EnableDisableWirelessAsync(wirelessType, builder => builder.Disabled());
Exemple #3
0
 internal void LoadFromJson(JToken pJson)
 {
     this.SSID     = pJson["ssid"].Value <string>();
     this.WLanType = (WirelessType)pJson["key_type"].Value <byte>();
 }