// Token: 0x060000E7 RID: 231 RVA: 0x00006310 File Offset: 0x00004510 private int _getFunction(int idx, ref string serial, ref string funcId, ref string funcName, ref string funcVal, ref string errmsg) { List <uint> functions = null; YAPI.YDevice dev = null; int devdescr = 0; int res = base._getDevice(ref dev, ref errmsg); if (YAPI.YISERR(res)) { base._throw(res, errmsg); return(res); } res = dev.getFunctions(ref functions, ref errmsg); if (YAPI.YISERR(res)) { return(res); } int fundescr = Convert.ToInt32(functions[idx]); res = YAPI.yapiGetFunctionInfo(fundescr, ref devdescr, ref serial, ref funcId, ref funcName, ref funcVal, ref errmsg); if (YAPI.YISERR(res)) { return(res); } return(0); }
// Token: 0x060000B4 RID: 180 RVA: 0x0000589C File Offset: 0x00003A9C public bool isOnline() { YAPI.YDevice dev = null; string errmsg = ""; YAPI.TJsonParser apires; return(this._cacheExpiration > YAPI.GetTickCount() || (!YAPI.YISERR(this._getDevice(ref dev, ref errmsg)) && !YAPI.YISERR(dev.requestAPI(out apires, ref errmsg)))); }
// Token: 0x060000B5 RID: 181 RVA: 0x000058E8 File Offset: 0x00003AE8 public int load(int msValidity) { YAPI.YDevice dev = null; string errmsg = ""; YAPI.TJsonParser apires = null; string errbuf = ""; string funcId = ""; int devdesc = 0; string serial = ""; string funcName = ""; string funcVal = ""; YAPI.TJSONRECORD?node = null; int res = this._getDevice(ref dev, ref errmsg); if (YAPI.YISERR(res)) { this._throw(res, errmsg); return(res); } res = dev.requestAPI(out apires, ref errmsg); if (YAPI.YISERR(res)) { this._throw(res, errmsg); return(res); } int fundescr = YAPI.yapiGetFunction(this._className, this._func, ref errmsg); if (YAPI.YISERR(fundescr)) { this._throw(res, errmsg); return(fundescr); } devdesc = 0; res = YAPI.yapiGetFunctionInfo(fundescr, ref devdesc, ref serial, ref funcId, ref funcName, ref funcVal, ref errbuf); if (YAPI.YISERR(res)) { this._throw(res, errmsg); return(res); } node = apires.GetChildNode(null, funcId); if (node == null) { this._throw(-8, "unexpected JSON structure: missing function " + funcId); return(-8); } this._parse(node.GetValueOrDefault()); this._cacheExpiration = YAPI.GetTickCount() + (long)msValidity; return(0); }
// Token: 0x060000A4 RID: 164 RVA: 0x00005168 File Offset: 0x00003368 protected int _getDevice(ref YAPI.YDevice dev, ref string errMsg) { int fundescr = 0; int res = this._getDescriptor(ref fundescr, ref errMsg); if (YAPI.YISERR(res)) { return(res); } int devdescr = YAPI.yapiGetDeviceByFunction(fundescr, ref errMsg); if (YAPI.YISERR(devdescr)) { return(devdescr); } dev = YAPI.YDevice.getDevice(devdescr); return(0); }
// Token: 0x060000E8 RID: 232 RVA: 0x00006394 File Offset: 0x00004594 public int functionCount() { List <uint> functions = null; YAPI.YDevice dev = null; string errmsg = ""; int res = base._getDevice(ref dev, ref errmsg); if (YAPI.YISERR(res)) { base._throw(res, errmsg); return(res); } res = dev.getFunctions(ref functions, ref errmsg); if (YAPI.YISERR(res)) { functions = null; base._throw(res, errmsg); return(res); } return(functions.Count); }
// Token: 0x060000A7 RID: 167 RVA: 0x000054A0 File Offset: 0x000036A0 protected int _setAttr(string attrname, string newvalue) { string errmsg = ""; string request = ""; YAPI.YDevice dev = null; int res = this._buildSetRequest(attrname, newvalue, ref request, ref errmsg); if (YAPI.YISERR(res)) { this._throw(res, errmsg); return(res); } res = this._getDevice(ref dev, ref errmsg); if (YAPI.YISERR(res)) { this._throw(res, errmsg); return(res); } res = dev.HTTPRequestAsync(request, ref errmsg); if (YAPI.YISERR(res)) { res = YAPI.yapiUpdateDeviceList(1U, ref errmsg); if (YAPI.YISERR(res)) { this._throw(res, errmsg); return(res); } res = dev.HTTPRequestAsync(request, ref errmsg); if (YAPI.YISERR(res)) { this._throw(res, errmsg); return(res); } } this._cacheExpiration = 0L; return(0); }
//--- (end of generated code: YDataLogger implementation) public int getData(long runIdx, long timeIdx, ref YAPI.TJsonParser jsondata) { YAPI.YDevice dev = null; string errmsg = ""; string query = null; string buffer = ""; int res = 0; if (_dataLoggerURL == "") { _dataLoggerURL = "/logger.json"; } // Resolve our reference to our device, load REST API res = _getDevice(ref dev, ref errmsg); if (YAPI.YISERR(res)) { _throw(res, errmsg); return(res); } if (timeIdx > 0) { query = "GET " + _dataLoggerURL + "?run=" + runIdx.ToString() + "&time=" + timeIdx.ToString() + " HTTP/1.1\r\n\r\n"; } else { query = "GET " + _dataLoggerURL + " HTTP/1.1\r\n\r\n"; } res = dev.HTTPRequest(query, ref buffer, ref errmsg); if (YAPI.YISERR(res)) { res = YAPI.UpdateDeviceList(ref errmsg); if (YAPI.YISERR(res)) { _throw(res, errmsg); return(res); } res = dev.HTTPRequest("GET " + _dataLoggerURL + " HTTP/1.1\r\n\r\n", ref buffer, ref errmsg); if (YAPI.YISERR(res)) { _throw(res, errmsg); return(res); } } try { jsondata = new YAPI.TJsonParser(buffer); } catch (Exception e) { errmsg = "unexpected JSON structure: " + e.Message; _throw(YAPI.IO_ERROR, errmsg); return(YAPI.IO_ERROR); } if (jsondata.httpcode == 404 && _dataLoggerURL != "/dataLogger.json") { // retry using backward-compatible datalogger URL _dataLoggerURL = "/dataLogger.json"; return(this.getData(runIdx, timeIdx, ref jsondata)); } return(YAPI.SUCCESS); }