Ejemplo n.º 1
0
        public void loadIDCTags(ref int nDeviceTableIndex, ref DWORD nextAvailableDeviceOffset)
        {
            //declare deviceEntry and offset for tag
            //device offset is passed in by ref
            Device.DEVICEENTRY _deviceEntry = new Device.DEVICEENTRY();
            DWORD nextAvailableTagOffset;

            //assign name and ID to each device
            _deviceEntry.strName = _devicename;
            _deviceEntry.strID = nDeviceTableIndex.ToString();

            //add deviceEntry to deviceEntryList in CID class
            CID.deviceEntryList.Add(_deviceEntry);

            //create a new device using the newly established deviceEntry
            _device = new Device(_deviceEntry);

            //set offset for device
            //initial offset is set at 0 when passed in by ref
            //each offset after will be determined based off of next available tag offset after iteration of tags
            _device.SetSharedMemoryOffset(nextAvailableDeviceOffset);

            //reset tag offset back to 0 for each device
            nextAvailableTagOffset = 0;

            //load tags to passed in device
            //each namespace will incremement the tag offset to be used for the next namespace
            DCE.loadIDCTags(ref _device, ref nextAvailableTagOffset);
            CondCur.loadIDCTags(ref _device, ref nextAvailableTagOffset);
            CondLast.loadIDCTags(ref _device, ref nextAvailableTagOffset);
            SYS.loadIDCTags(ref _device, ref nextAvailableTagOffset);

            _astate.stateActive = _initState;
            _astate.stateLast = _initState;

            //Set Default Condition Values Into Namespace
            setCondition(_astate.condActive, CondCur, _astate.stateActive);
            setCondition(_astate.condLast, CondLast, _astate.stateLast);

            //set system config ok value for asset
            SYS.ConfigOK.valueBool = configOK;

            //make next device offset
            nextAvailableDeviceOffset += nextAvailableTagOffset;

            //add device to table in CID
            //used currently for exporting config file
            CID.deviceSet.Add(_device);

            nDeviceTableIndex++;
        }
Ejemplo n.º 2
0
        public static Tag GetNextTag(ref Device pDev, ref bool bIsLast)
        {
            bIsLast = false;

            //Look for empty set
            if (pDev.tagSet.Count == 0)
            {
                return (null);
            }
            Tag retTag = pDev.tagSet[nextTagIndex];

            //If this is the last tag in the list, set flag
            if (++nextTagIndex == pDev.tagSet.Count)
            {
                bIsLast = true;
                nextTagIndex = 0;
            }

            return (retTag);
        }
Ejemplo n.º 3
0
 public void loadIDCTags(ref Device _device, ref DWORD nextAvailableTagOffset)
 {
     for (int i = 0; i < tagEntryList.Count; i++)
     {
         //find the next offset that is returned by AddTag, get a reference ot refTag and save it
         nextAvailableTagOffset = _device.AddTag(tagEntryList[i], nextAvailableTagOffset, out TagList[i].tag);
         TagList[i].propertySet();
     }
 }
Ejemplo n.º 4
0
        public Tag(ref Device device, TAGENTRY tTagEntry, DWORD dwRelativeOffset, DWORD dwParentOffset)
        {
            tagDevice = device;

            tagName = tTagEntry.strName;
            tagStringSize = tTagEntry.stringSize;
            tagArrayRows = tTagEntry.arrayRows;
            tagArrayCols = tTagEntry.arrayCols;
            tagDataType = tTagEntry.dataType;
            tagReadWrite = tTagEntry.Access;
            tagScanRateMS = 100;
            tagDescription = tTagEntry.description;
            tagGroupName = tTagEntry.groupName;

            tagRelativeOffset = dwRelativeOffset;
            tagSharedMemoryOffset = dwParentOffset + dwRelativeOffset;
            tagWriteRequestPending = false;
            tagReadRequestPending = false;
            tagWriteResponsePending = false;
            tagReadResponsePending = false;

            if ((tTagEntry.Access == AccessType.READONLY) ||
                (tTagEntry.Access == AccessType.READWRITE))
            {
                tagReadData = new TagData(tTagEntry.dataType,
                    tTagEntry.stringSize, tTagEntry.arrayRows, tTagEntry.arrayCols);
            }

            if ((tTagEntry.Access == AccessType.READWRITE) ||
                (tTagEntry.Access == AccessType.WRITEONLY))
            {
                tagWriteData = new TagData(tTagEntry.dataType,
                    tTagEntry.stringSize, tTagEntry.arrayRows, tTagEntry.arrayCols);
            }
        }