public void TestSearchDevices() { var client = new DefaultOneNETClient(url, appkey, ""); //test keywords var req = new SearchDeviceRequest { Protocol = Scheme.HTTP, Keywords = "768" }; var resp = client.Execute(req); Assert.IsFalse(resp.IsError); Assert.AreEqual(0, resp.Errno); Assert.AreEqual("succ", resp.Error); Assert.IsNotNull(resp.Data); Assert.AreEqual(2, resp.Data.Total_Count); //test other para var req2 = new SearchDeviceRequest { Protocol = Scheme.HTTP, Private = false }; var client2 = new DefaultOneNETClient(url, appkey, ""); var resp2 = client2.Execute(req2); Assert.IsFalse(resp2.IsError); Assert.IsNotNull(resp2.Data); Assert.AreEqual(1, resp2.Data.Total_Count); }
public RepeatedField <Connect.SearchDeviceInfo> SearchDevice() { var request = new SearchDeviceRequest { Timeout = SEARCH_TIMEOUT_MS }; var response = connectClient.SearchDevice(request); return(response.DeviceInfos); }
public IEnumerable <Device> GetAllDevices(Status?status = null, DateTime?modifiedSince = null) { var date = modifiedSince ?? defaultModifiedSince; var page = 1; SearchDeviceResponse resp = null; do { resp = new SearchDeviceRequest(key, date, page, null, status).GetResponse().Result; foreach (var device in resp.Devices) { yield return(device); } page = resp.PageNumber + 1; } while(!resp?.LastPage ?? true); }