public YPEntry(string serial, string functionID, BaseClass baseclass) { _serial = serial; _funcId = functionID; _baseclass = baseclass; _classname = YAPIContext.imm_functionClass(_funcId); }
// Set a function advertised value by hardware id internal virtual void imm_setFunctionValue(string hwid, string pubval) { string classname = YAPIContext.imm_functionClass(hwid); YFunctionType fnByType = imm_getFnByType(classname); fnByType.imm_setFunctionValue(hwid, pubval); }
// Find the hardwareId for the next instance of a given function class internal virtual string imm_getNextHardwareId(string className, string hwid) { if (!_yctx._BaseType.ContainsKey(className)) { YFunctionType ft = imm_getFnByType(className); YPEntry yp = ft.imm_getNextYPEntry(hwid); if (yp == null) { return(null); } return(yp.HardwareId); } else { // enumeration of an abstract class YPEntry.BaseClass baseType = _yctx._BaseType[className]; string prevclass = YAPIContext.imm_functionClass(hwid); YPEntry res = imm_getFnByType(prevclass).imm_getNextYPEntry(hwid); if (res != null) { return(res.HardwareId); } foreach (string altClassName in _fnByType.Keys) { if (!prevclass.Equals("")) { if (!altClassName.Equals(prevclass)) { continue; } prevclass = ""; continue; } YFunctionType functionType = _fnByType[altClassName]; res = functionType.imm_getFirstYPEntry(); if (res != null && res.getBaseClass().Equals(baseType)) { return(res.HardwareId); } } return(null); } }
public YPEntry(YJSONObject json) { string hardwareId = json.getString("hardwareId"); int pos = hardwareId.IndexOf('.'); _serial = hardwareId.Substring(0, pos); _funcId = hardwareId.Substring(pos + 1); _classname = YAPIContext.imm_functionClass(_funcId); _logicalName = json.getString("logicalName"); _advertisedValue = json.getString("advertisedValue"); _index = json.getInt("index"); if (json.has("baseType")) { _baseclass = BaseClass.values()[json.getInt("baseType")]; } else { _baseclass = BaseClass.Function; } }