Ejemplo n.º 1
0
        public void StartTraceData(string stationUID, dc_EnumConstJBC.dc_Port portNbr)
        {
            // start tracing one port

            long stationID = DLLConnection.jbc.GetStationID(stationUID);

            if (stationID == -1)
            {
                return;
            }

            //Start station continuous mode for the desired station and initialize num sequence
            if (!m_htStationQueue.Contains(stationUID))
            {
                //speed
                if (!m_htStationSpeed.Contains(stationUID))
                {
                    m_htStationSpeed.Add(stationUID, SpeedContinuousMode.OFF); // defaults to physical speed
                }

                //Num sequence
                m_htStationNumSequence.Add(stationUID, 0);
                //station ID
                m_htStationID.Add(stationUID, stationID);

                uint queueID = DLLConnection.jbc.StartContinuousMode(stationID, (SpeedContinuousMode)(m_htStationSpeed[stationUID]));

                m_htStationQueue.Add(stationUID, queueID);
            }

            //Add port to list
            Hashtable listPortsData = default(Hashtable);

            if (m_htStationPortsData.Contains(stationUID))
            {
                listPortsData = (Hashtable)(m_htStationPortsData[stationUID]);
            }
            else
            {
                listPortsData = new Hashtable();
            }

            if (!listPortsData.Contains((Port)portNbr))
            {
                listPortsData.Add((Port)portNbr, new TracePortData((Port)portNbr));
                m_htStationPortsData[stationUID] = listPortsData;
            }
            evlogWrite("Added trace port: " + portNbr.ToString(), stationUID);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Get the user ID associated to a station
        /// </summary>
        /// <param name="stationUID">Station UID</param>
        /// <param name="portNbr">Port number</param>
        /// <returns>User ID. If there is no user associated, return an empty string</returns>
        public string GetAuthenticatedUser(string stationUID, dc_EnumConstJBC.dc_Port portNbr)
        {
            string userCode = "";

            PortStation portStation = new PortStation();

            portStation.portNbr    = portNbr;
            portStation.stationUID = stationUID;

            if (m_htStationUserCode.Contains(portStation))
            {
                userCode = (m_htStationUserCode[portStation]).ToString();
            }

            return(userCode);
        }
Ejemplo n.º 3
0
        public void StopTraceData(string stationUID, dc_EnumConstJBC.dc_Port portNbr)
        {
            // stop tracing one port

            if (m_htStationPortsData.Contains(stationUID))
            {
                Hashtable listPortData = (Hashtable)(m_htStationPortsData[stationUID]);

                if (listPortData.Contains((Port)portNbr))
                {
                    listPortData.Remove((Port)portNbr);
                }

                evlogWrite("Stop trace port: " + portNbr.ToString(), stationUID);

                //Comprobar si existe algún puerto mas que se esté trazando
                if (listPortData.Count == 0)
                {
                    long stationID = -1;
                    try
                    {
                        //stationID = jbc.GetStationID(stationUID)
                        stationID = System.Convert.ToInt64(m_htStationID[stationUID]);
                        DLLConnection.jbc.StopContinuousMode(stationID, System.Convert.ToUInt32(System.Convert.ToUInt32(m_htStationQueue[stationUID])));
                    }
                    catch (Exception)
                    {
                    }

                    m_htStationQueue.Remove(stationUID);
                    m_htStationID.Remove(stationUID);
                    m_htStationPortsData.Remove(stationUID);
                    m_htStationNumSequence.Remove(stationUID);
                    m_htStationSpeed.Remove(stationUID);

                    evlogWrite("Stop trace station.", stationUID);

                    //Cierre y renombre del fichero con id único
                    if (File.Exists(tempPathFilename(m_folderData, stationID)))
                    {
                        (new Microsoft.VisualBasic.Devices.ServerComputer()).FileSystem.WriteAllText(tempPathFilename(m_folderData, stationID), "}", true);
                        (new Microsoft.VisualBasic.Devices.ServerComputer()).FileSystem.MoveFile(tempPathFilename(m_folderData, stationID), tracePathFilename(m_folderData, stationID, DateTime.Now));
                    }
                }
            }
        }
Ejemplo n.º 4
0
        private Hashtable m_htUserCodeUserName = new Hashtable();        //userCode <-> userName


        /// <summary>
        /// Creates a new user session associated with a station
        /// </summary>
        /// <param name="stationUID">Station UID</param>
        /// <param name="portNbr">Port number</param>
        /// <param name="userCode">User ID</param>
        /// <param name="userName">User name</param>
        /// <param name="deviceName">Keyboard input ID</param>
        /// <returns>True if the station is not associated yet and the operation was succesful</returns>
        public bool NewUserSession(string stationUID, dc_EnumConstJBC.dc_Port portNbr, string userCode, string userName, string deviceName)
        {
            PortStation portStation = new PortStation();

            portStation.portNbr    = portNbr;
            portStation.stationUID = stationUID;


            //check station is not already associated
            bool isNewAssociated = !m_htStationUserCode.Contains(portStation);

            if (isNewAssociated)
            {
                //keyboard <-> userCode
                if (deviceName != "")
                {
                    if (m_htKeyboardUserCode.Contains(deviceName))
                    {
                        m_htKeyboardUserCode[deviceName] = userCode;
                    }
                    else
                    {
                        m_htKeyboardUserCode.Add(deviceName, userCode);
                    }
                }

                //station <-> userCode
                m_htStationUserCode.Add(portStation, userCode);

                //userCode <-> userName
                if (m_htUserCodeUserName.Contains(userCode))
                {
                    m_htUserCodeUserName[userCode] = userName;
                }
                else
                {
                    m_htUserCodeUserName.Add(userCode, userName);
                }
            }

            return(isNewAssociated);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Delete an user session associated with a station
        /// </summary>
        /// <param name="stationUID">Station UID</param>
        /// <param name="portNbr">Port number</param>
        /// <returns>True if the session exists and it was deleted</returns>
        public bool CloseUserSession(string stationUID, dc_EnumConstJBC.dc_Port portNbr)
        {
            bool bOk = false;

            PortStation portStation = new PortStation();

            portStation.portNbr    = portNbr;
            portStation.stationUID = stationUID;

            //keyboard <-> userCode
            //no remove

            //station <-> userCode
            if (m_htStationUserCode.Contains(portStation))
            {
                m_htStationUserCode.Remove(portStation);
                bOk = true;
            }

            //userCode <-> userName
            //no remove

            return(bOk);
        }