public async System.Threading.Tasks.Task <string> GettrackPendingInfoAsync(string Track_id) { string authorisation = await HTTP_Request.HTTP_GETAsync(Core.Host, "/api/v3/login/authorize/" + Track_id, null); JObject response = JObject.Parse(authorisation); if ((bool)response["success"] == true) { System.Diagnostics.Debug.WriteLine("Success request"); string status = (string)response["result"]["status"]; //checking the status if (status == "granted") { return("granted"); } else if (status == "timeout") { throw new Exception("Request timeout"); } } else { System.Diagnostics.Debug.WriteLine(response["msg"]); System.Diagnostics.Debug.WriteLine(response["error_code"]); return("error"); } return("waiting"); }
public async Task <bool> SendAuthorisationRequest() { JObject request = new JObject { { "app_id", App_id }, { "app_name", App_name }, { "app_version", Version }, { "device_name", DeviceName }, }; //serializing string authReq = request.ToString(); string authorisation = await HTTP_Request.HTTP_POSTAsync(Core.Host, "/api/v3/login/authorize", authReq); JObject response = JObject.Parse(authorisation); bool success = (bool)response["success"]; if (success) { this.App_token = (string)response["result"]["app_token"]; this.Track_id = (string)response["result"]["track_id"]; } return(success); }
public async System.Threading.Tasks.Task <bool> GetWifiInfoAsync() { string JsonResponse = await HTTP_Request.HTTP_GETAsync(Core.Host, "/api/v3/wifi/config/", null); System.Diagnostics.Debug.WriteLine(JsonResponse); JObject response = JObject.Parse(JsonResponse); bool success = (bool)response["success"]; bool enabled = (bool)response["result"]["enabled"]; string mac_filter_state = (string)response["result"]["mac_filter_state"]; return(enabled); }
public async Task <List <CallEntry> > GetCallsAsync() { string JsonResponse = await HTTP_Request.HTTP_GETAsync(Core.Host, "/api/v3/call/log/", null); JObject response = JObject.Parse(JsonResponse); bool success = (bool)response["success"]; if (success) { return(Newtonsoft.Json.JsonConvert.DeserializeObject <List <CallEntry> >(response["result"].ToString())); } return(null); }
public async System.Threading.Tasks.Task <bool> SetWifiAsync(bool enabled) { if (HTTP_Request.Fbx_Header != null && HTTP_Request.Fbx_Header != "") { JObject request = new JObject { { "enabled", enabled } }; string JsonResponse = await HTTP_Request.HTTP_PUTAsync(Core.Host, "/api/v3/wifi/config/", request.ToString()); JObject response = JObject.Parse(JsonResponse); bool success = (bool)response["success"]; if (success) { return((bool)response["result"]["enabled"]); } } throw new Exception("No FBX Header given"); }
public async System.Threading.Tasks.Task <string> GetChallengeValueAsync() { string challenge = ""; /* * { * "success": true, * "result": { * "logged_in": false, * "challenge": "VzhbtpR4r8CLaJle2QgJBEkyd8JPb0zL" * } * } */ //update challenge and return if we are loggin or not HTTP_Request.SessionToken = this.Session_token; string JsonResponse = await HTTP_Request.HTTP_GETAsync(Core.Host, "/api/v3/login", null); HTTP_Request.SessionToken = ""; JObject response = JObject.Parse(JsonResponse); bool responseSucess = (bool)response["success"]; if (responseSucess) { challenge = (string)response["result"]["challenge"]; this.loggedIn = (bool)response["result"]["logged_in"]; System.Diagnostics.Debug.WriteLine("Challenge : " + Challenge); } else { throw new LoginFailedException(); } return(challenge); }
public async System.Threading.Tasks.Task <bool> OpenSessionAsync(string password) { JObject request = new JObject { { "app_id", App_id }, { "password", password } }; System.Diagnostics.Debug.WriteLine("Request calling : " + request.ToString()); // post request HTTP_Request.SessionToken = this.Session_token; string JsonResponse = await HTTP_Request.HTTP_POSTAsync(Core.Host, "/api/v3/login/session/", request.ToString()); HTTP_Request.SessionToken = ""; JObject response = JObject.Parse(JsonResponse); bool success = (bool)response["success"]; if (success) { this.Challenge = (string)response["result"]["challenge"]; this.Session_token = (string)response["result"]["session_token"]; this.Permissions = response["result"]["permissions"]; } else { string msg = (string)response["msg"]; string error_code = (string)response["error_code"]; System.Diagnostics.Debug.WriteLine("Cannot connect : " + msg + " " + error_code); this.Challenge = (string)response["result"]["challenge"]; } return(success); }
public async System.Threading.Tasks.Task GetListLanHostObjectAsync() { string JsonResponse = await HTTP_Request.HTTP_GETAsync(Core.Host, "/api/v3/lan/browser/pub", null); }
public async System.Threading.Tasks.Task GetLanInterfacesAsync() { string JsonResponse = await HTTP_Request.HTTP_GETAsync(Core.Host, "/api/v3/lan/browser/interfaces", null); }