//========================================================================= /// <summary> /// Assign a driver value. /// </summary> /// <param name="driverID"></param> /// <param name="providerID">Component that provided the value.</param> /// <param name="aValue">Returned value.</param> //========================================================================= public override void assignDriver(int driverID, uint providerID, TTypedValue aValue) { if (driverID == drvCOMPCLASS) //if this driver was a comp.type { if (compInfoList.Count == 1) { foreach (KeyValuePair <String, List <TComp> > pair in compInfoList) { List <TComp> comps = pair.Value; for (int i = 0; i < comps.Count; i++) { TComp comp = comps[i]; if (comp.compID == providerID) { comp.CompClass = aValue.asString(); //store the class type comps[i] = comp; } } } } else { throw new Exception("More requests using compInfoList<> than expected in assignDriver()"); } } else { if (!Comp.assignDriver(driverID, providerID, aValue)) { base.assignDriver(driverID, providerID, aValue); } } }
//========================================================================= /// <summary> /// A handler for returnInfo message. /// </summary> /// <param name="sReqName">Name of the entity requested.</param> /// <param name="sReturnName">Name of the entity returned.</param> /// <param name="ownerID">ID of the owning component of the entity.</param> /// <param name="entityID">ID of the entity found.</param> /// <param name="iKind">Kind of entity.</param> /// <param name="sDDML">DDML type of the entity.</param> //========================================================================= public override void processEntityInfo(string sReqName, string sReturnName, uint ownerID, uint entityID, int iKind, string sDDML) { base.processEntityInfo(sReqName, sReturnName, ownerID, entityID, iKind, sDDML); //queryInfo's have been sent for sibling component names if ((iKind == TypeSpec.KIND_COMPONENT) || (iKind == TypeSpec.KIND_SYSTEM)) { if (compInfoList.ContainsKey(sReqName)) { List <TComp> comps; if (compInfoList.TryGetValue(sReqName, out comps)) { TComp foundComp = new TComp(); foundComp.compID = entityID; foundComp.name = sReturnName; if (entityID == Comp.ComponentID) //if it is this component then take a shortcut { foundComp.CompClass = FType; //use the local value } else { foundComp.CompClass = sDDML; } foundComp.isSystem = (iKind == TypeSpec.KIND_SYSTEM || foundComp.CompClass.ToLower() == "paddock" || foundComp.CompClass.ToLower() == "protocolmanager"); comps.Add(foundComp); if (foundComp.CompClass.Length <= 1) // if type information was absent, do a GetValue to find it's type { //now do a getvalue to find the class type of the component drvCOMPCLASS = driverCount(); registerDriver(sReturnName + ".type", drvCOMPCLASS, 1, 1, "-", false, "<type kind=\"string\"></type>", "", "", 0); sendDriverRequest(drvCOMPCLASS, 0); } } } else { } } else { //assume that any other type being returned will be placed into the entity info list because //of a call to queryEntityInfo() if (entityInfoList.ContainsKey(sReqName)) { List <TIDSpec> entities; if (entityInfoList.TryGetValue(sReqName, out entities)) { TIDSpec foundEntity = new TIDSpec(); foundEntity.compID = ownerID; foundEntity.itemID = entityID; foundEntity.kind = iKind; foundEntity.name = sReturnName; foundEntity.sType = sDDML; entities.Add(foundEntity); } } } }