mirror of
https://bitbucket.org/myhomie/mycorerepository.git
synced 2025-12-06 09:41:19 +00:00
Arlo service init + Test commit from Thelis
This commit is contained in:
parent
0441baa6b2
commit
8da2ae56df
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
MyCore/bin
|
||||||
|
MyCore/obj
|
||||||
|
.vs
|
||||||
11
MyCore/Services/ArloService.cs
Normal file
11
MyCore/Services/ArloService.cs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace MyCore.Services
|
||||||
|
{
|
||||||
|
public class ArloService
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -69,23 +69,28 @@ namespace MyCore.Services
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
// LOGIN
|
||||||
var loginTask = Task.Run(() => PostURI(new Uri(_loginUrl), RequestType.Login));
|
var loginTask = Task.Run(() => PostURI(new Uri(_loginUrl), RequestType.Login));
|
||||||
loginTask.Wait();
|
loginTask.Wait();
|
||||||
|
|
||||||
if (loginTask.Result != "")
|
if (loginTask.Result != "")
|
||||||
{
|
{
|
||||||
|
//RESULT TOKEN
|
||||||
var data = ((JObject)JsonConvert.DeserializeObject(loginTask.Result))["data"];
|
var data = ((JObject)JsonConvert.DeserializeObject(loginTask.Result))["data"];
|
||||||
resultToken = JsonConvert.DeserializeObject<ResultToken>(data.ToString());
|
resultToken = JsonConvert.DeserializeObject<ResultToken>(data.ToString());
|
||||||
|
|
||||||
|
// GET DEVICE LIST
|
||||||
var deviceTask = Task.Run(() => PostURI(new Uri(_devList), RequestType.DeviceList));
|
var deviceTask = Task.Run(() => PostURI(new Uri(_devList), RequestType.DeviceList));
|
||||||
deviceTask.Wait();
|
deviceTask.Wait();
|
||||||
|
|
||||||
if (deviceTask.Result != "")
|
if (deviceTask.Result != "")
|
||||||
{
|
{
|
||||||
data = ((JObject)JsonConvert.DeserializeObject(deviceTask.Result))["data"];
|
data = ((JObject)JsonConvert.DeserializeObject(deviceTask.Result))["data"];
|
||||||
|
// RETRIEVE ALL DEVICES
|
||||||
allDevices = JsonConvert.DeserializeObject<List<MerossDevice>>(data.ToString());
|
allDevices = JsonConvert.DeserializeObject<List<MerossDevice>>(data.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RETRIEVE LOG
|
||||||
var logTask = Task.Run(() => PostURI(new Uri(_logUrl), RequestType.Log));
|
var logTask = Task.Run(() => PostURI(new Uri(_logUrl), RequestType.Log));
|
||||||
logTask.Wait();
|
logTask.Wait();
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user