internal override async Task <int> ping(uint mstimeout) { // ping dot not use Notification handler but a one shot http request YHTTPRequest req = new YHTTPRequest(this, "ping"); await req.RequestSync("GET /api/module/firmwareRelease.json", null, mstimeout); return(YAPI.SUCCESS); }
internal override async Task <byte[]> devRequestSync(YDevice device, string req_first_line, byte[] req_head_and_body, uint mstimeout, YGenericHub.RequestProgress progress, object context) { ulong start = YAPI.GetTickCount(); if (!_httpReqByDev.ContainsKey(device)) { _httpReqByDev[device] = new YHTTPRequest(_hub, "Device " + device.SerialNumber); } YHTTPRequest req = _httpReqByDev[device]; byte[] result = await req.RequestSync(req_first_line, req_head_and_body, mstimeout); ulong stop = YAPI.GetTickCount(); //Debug.WriteLine(string.Format("SyncRes on {0} took {1}ms", device.SerialNumber, stop - start)); return(result); }
internal override async Task <byte[]> hubRequestSync(string req_first_line, byte[] req_head_and_body, uint mstimeout) { YHTTPRequest req = new YHTTPRequest(_hub, "request to " + _hub.Host); return(await req.RequestSync(req_first_line, req_head_and_body, mstimeout)); }