/// <summary> /// Internal function to retrieve datalogger memory /// </summary> internal virtual async Task <byte[]> getData(int?runIdx, int?timeIdx) { if (_dataLoggerURL == null) { _dataLoggerURL = "/logger.json"; } // get the device serial number YModule mod = await module(); string devid = await mod.get_serialNumber(); string httpreq = "GET " + _dataLoggerURL; if (timeIdx != null) { httpreq += string.Format("?run={0:D}&time={1:D}", runIdx, timeIdx); } byte[] result; YDevice dev = _yapi._yHash.imm_getDevice(devid); try { result = await dev.requestHTTPSync(httpreq, null); } catch (YAPI_Exception ex) { if (!_dataLoggerURL.Equals("/dataLogger.json")) { _dataLoggerURL = "/dataLogger.json"; return(await getData(runIdx, timeIdx)); } throw ex; } return(result); }
private async Task <byte[]> _request(string req_first_line, byte[] req_head_and_body) { YDevice dev = await getYDevice(); return(await dev.requestHTTPSync(req_first_line, req_head_and_body)); }