/// <summary>
        /// Manage a race from real sensor data
        /// </summary>
        public void Start(RaceConfig config, List <Rider> riders)
        {
            Stop();

            CommunicationManager CommunicationManager = new CommunicationManager(source.Token);

            SerialTimingUnit timer = new SerialTimingUnit(CommunicationManager.GetCommunicationDevice(config.TimingUnitId), "timerUnit", source.Token, config.StartTimingGateId, config.EndTimingGateId);

            timing = timer;
            displays.Add(timer);
            BLERiderIdUnit realStartId = new BLERiderIdUnit(CommunicationManager.GetCommunicationDevice(config.StartIdUnitId), "startUnit", config.StartIdRange, source.Token);

            endGate = new BLERiderIdUnit(CommunicationManager.GetCommunicationDevice(config.EndIdUnitId), "finishUnit", config.EndIdRange, source.Token);

            startGate  = realStartId;
            startLight = realStartId;

            startGate?.ClearKnownRiders();
            endGate?.ClearKnownRiders();

            startLight.SetStartLightColor(StartLightColor.YELLOW);

            startGate.AddKnownRiders(riders);

            tracker = new RaceTracker(timing, startGate, endGate, config.ExtractTrackerConfig(), riders);
            HookEvents(tracker);

            CombinedTasks = tracker.Run(source.Token);
        }
Exemple #2
0
        // Called when the app starts
        public void Startup()
        {
            startStopEngine();

            // We want notification when the options change
            runtimeOptionsPad.Value.PropertyChanged += new PropertyChangedEventHandler((s, e) =>
            {
                if (e.PropertyName == m_RunAsServiceName)
                {
                    startStopEngine();
                }
                else if (e.PropertyName == m_PortNumberName)
                {
                    stopServiceEngine();
                    startStopEngine();
                }
            });

            // Watch for local engines
            var list = CommunicationManager.RegisterLocalPeerListChangedCallback(
                new CommunicationManager.LocalPeerListChangedHandler(
                    delegate(NodePeerList newList, NodePeerList oldList)
            {
                runtimeType.Value.SetLocalRuntimePeer(newList);
            }
                    ));

            runtimeType.Value.SetLocalRuntimePeer(list);
        }
        public void Initialize()
        {
            communicationManager             = new CommunicationManager("X-Token", ConfigurationManager.AppSettings["UnitTestToken"]);
            communicationManager.UnitTestUrl = ConfigurationManager.AppSettings["UnitTestUrl"];

            requestModel = new FinancialAssessmentModel()
            {
                ContactID                  = 1,
                FinancialAssessmentID      = 1,
                AssessmentDate             = DateTime.Now,
                TotalIncome                = 300000,
                TotalExpenses              = 30000,
                AdjustedGrossIncome        = 5000,
                TotalExtraOrdinaryExpenses = 100,
                TotalOther                 = 100,
                ExpirationDate             = DateTime.Now,
                ExpirationReasonID         = 0,
                FamilySize                 = 2
            };

            requestDetailsModel = new FinancialAssessmentDetailsModel()
            {
                FinancialAssessmentDetailsID = 1,
                FinancialAssessmentID        = 1,
                CategoryTypeID     = 1,
                Amount             = 100,
                FinanceFrequencyID = 17,
                CategoryID         = 1
            };
        }
 public void Initialize()
 {
     communicationManager             = new CommunicationManager("X-Token", ConfigurationManager.AppSettings["UnitTestToken"]);
     communicationManager.UnitTestUrl = ConfigurationManager.AppSettings["UnitTestUrl"];
     requestModel = new CallCenterProgressNoteModel
     {
         CallCenterHeaderID   = 0,
         CallCenterTypeID     = 1,
         ContactID            = 3,
         CallerID             = 1,
         ProviderID           = 1,
         ClientStatusID       = 4,
         CallCenterPriorityID = 1,
         Disposition          = "Testing",
         IsActive             = false,
         Comments             = "",
         ReasonCalled         = "Testing",
         CallStartTime        = DateTime.Now,
         CallStatusID         = 1,
         ProgramUnitID        = 1,
         CountyID             = 2,
         ModifiedOn           = DateTime.Now,
         ModifiedBy           = 1,
         SuicideHomicideID    = 3
     };
 }
        public MainViewModel(
            IViewModelNavigator navigator,
            IMessenger messenger,
            SessionService sessionService,
            CommunicationManager communicationManager,
            SettingsProvider settingsProvider)
        {
            _sessionService       = sessionService;
            _communicationManager = communicationManager;
            _settingsProvider     = settingsProvider;
            messenger.Register <ShowChildWindowMessage>(this, RaiseShowWindow);

            messenger.Register <WindowStateMessage>(this, state => RaiseStateChanged(state.State));

            messenger.Register <ContentChangedMessage>(this, OnContentChanged);
            //navigator.NavigateForward<WelcomeViewModel>(null); //temporary
            navigator.NavigateForward <PasswordPromptViewModel>(null);


            messenger.Register <CommandMessage>(this, OnOpenCommand);
            messenger.Register <CloseCommandMessage>(this, OnCloseCommand);
            UpdateSessionStart();
            communicationManager.Connect();
            _timer           = new DispatcherTimer();
            _timer.Interval  = new TimeSpan(0, 0, 15);
            _timer.IsEnabled = true;
            _timer.Tick     += SendPing;
            _timer.Start();
        }
Exemple #6
0
        public async Task InitializeAsync()
        {
            // Set js sources
            await _host.ReadAndExecuteAsync("wordreference.js");

            // Define types received from js
            CommunicationManager.RegisterType(typeof(Models.Dictionary));
            CommunicationManager.RegisterType(typeof(Models.Suggestion[]));
            CommunicationManager.RegisterType(typeof(Models.TranslationPart));
            CommunicationManager.RegisterType(typeof(Models.TranslationLine));
            CommunicationManager.RegisterType(typeof(Models.TranslationResult));

            // Receive data from js calls
            CommunicationManager.OnObjectReceived = (data) =>
            {
                if (data is Models.Suggestion[])
                {
                    SuggestionsResponse.Object = (Models.Suggestion[])data;
                    SuggestionsResponse.Done   = true;
                }

                if (data is Models.TranslationResult)
                {
                    TranslationResponse.Object = (Models.TranslationResult)data;
                    TranslationResponse.Done   = true;
                }
            };
        }
Exemple #7
0
    void Update()
    {
        // Typing indication icon
        typingIndicatorTimeout -= Time.deltaTime;

        if (GameManager.Inst.LocalPlayer)
        {
            if ((consoleGui.consoleInput != "") && (consoleGui.consoleInput[0] != '/') && (consoleGui.consoleInput.Length > lastConsoleText.Length))
            {
                typingIndicatorTimeout = 3f;
                if (!GameManager.Inst.LocalPlayer.IsTyping)
                {
                    GameManager.Inst.LocalPlayer.IsTyping = true;
                    ISFSObject typingObj = new SFSObject();
                    typingObj.PutBool("typn", true);
                    typingObj.PutInt("plyr", GameManager.Inst.LocalPlayer.Id);
                    CommunicationManager.SendObjectMsg(typingObj);
                }
            }
            else if (GameManager.Inst.LocalPlayer.IsTyping && ((consoleGui.consoleInput == "") || (typingIndicatorTimeout <= 0f)))
            {
                GameManager.Inst.LocalPlayer.IsTyping = false;
                ISFSObject typingObj = new SFSObject();
                typingObj.PutBool("typn", false);
                typingObj.PutInt("plyr", GameManager.Inst.LocalPlayer.Id);
                CommunicationManager.SendObjectMsg(typingObj);
            }
            lastConsoleText = consoleGui.consoleInput;
        }

        fadeAlpha = Mathf.MoveTowards(fadeAlpha, fadeOut ? 1 : 0, Time.deltaTime);
    }
 public override void Start(RAIN.Core.AI ai)
 {
     base.Start(ai);
     if (commManager == null) {
         commManager = ai.GetCustomElement<CommunicationManager>();
     }
 }
Exemple #9
0
 public frmMapIt(CommunicationManager mainComWin)
 {
     this._html_file = string.Empty;
     this.IsRealTime = true;
     this.InitializeComponent();
     this.CommWindow = mainComWin;
 }
Exemple #10
0
 public void switchOn(CommunicationManager comm)
 {
     comm.OpenPort();
     comm.WriteData(switchOnSignal);
     //comm.ClosePort();
     isSwitchedOn = true;
 }
Exemple #11
0
 public void switchOff(CommunicationManager comm)
 {
     comm.OpenPort();
     comm.WriteData(switchOffSignal);
     isSwitchedOn = false;
     //inicomm.ClosePort();
 }
Exemple #12
0
        private void newOutgoingConnection()
        {
            int port = Properties.Settings.Default.PortNumber;

            if (!Properties.Settings.Default.RunAsService)
            {
                port = 0;
            }
            if (port != m_port)
            {
                if (port > 0)
                {
                    m_port = port;
                    m_outgoingConnection = CommunicationManager.StartOutgoingConnection(
                        new FieldIdentifier("test"), "localhost", port);
                    var remoteList = m_outgoingConnection.RegisterRemotePeerListChangedCallback(
                        new NodeConnection.RemotePeerListChangedHandler(
                            delegate(NodePeerList remotePeerList)
                    {
                        runtimeType.Value.SetLocalRuntimePeer(remotePeerList);
                    }
                            ));
                    runtimeType.Value.SetLocalRuntimePeer(remoteList);
                }
            }
        }
Exemple #13
0
        public MainWindow()
        {
            InitializeComponent();
            var r = new Random();
            _port = r.Next(1500, 2000);
            _id = Guid.NewGuid();

            _sessions = new Dictionary<IPEndPoint, Tuple<Peer, PascalMessageHandler>>();
            _listener = new TcpListener(_port);
            _comunicationManager = new CommunicationManager(_listener);
            _comunicationManager.ConnectionClosed += ChatOnMemberDisconnected;
            _comunicationManager.PeerConnected += ChatOnMemberConnected;
            _comunicationManager.ConnectionFailed += ChatOnMemberConnectionFailure;
            _comunicationManager.PeerDataReceived += OnPeerDataReceived;

            _listener.Start();

            _discovery = new UdpListener(3000);
            _discovery.UdpPacketReceived += DiscoveryOnUdpPacketReceived;
            _discovery.Start();

            using (var socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp))
            {
                socket.EnableBroadcast = true;
                var group = new IPEndPoint(IPAddress.Broadcast, 3000);
                var hi = Encoding.ASCII.GetBytes("Hi Peer2Net node here:" + _id + ":127.0.0.1:" + _port);
                socket.SendTo(hi, group);
                socket.Close();
            }
        }
        /// <summary> send command queue constructor. </summary>
        /// <param name="communicationManager">The communication manager instance</param>
        /// <param name="sendBufferMaxLength">Length of the send buffer</param>
        public SendCommandQueue(CommunicationManager communicationManager, int sendBufferMaxLength)
        {
            MaxQueueLength = 5000;

            _communicationManager = communicationManager;
            _sendBufferMaxLength  = sendBufferMaxLength;
        }
Exemple #15
0
        /// <summary>
        /// All static classes and singletons meant for global
        /// usage are activated here. Some areas depend on these classes having their
        /// data loaded before the program starts (e.g., OdometerTracker), so it
        /// is very important that they are called here. All static classes should at
        /// the bare minimum implement an empty Activate() method to ensure their
        /// constructors are called
        /// </summary>
        private void ActivateStaticClasses()
        {
            EventBridge.Initialize();
            DiagnosticsParser.Initialize();
            CanMessageHandler.Initialize();
            ConfigManager.LoadConfiguration();
            DiagnosticLogger.Initialize();
            RawLogger.Initialize();
            PIDValueStager.Initialize();
            _EngineDataParser = new EngineDataParser();
            _Acceleration     = new Acceleration();
            _Trackers         = new Trackers();
            ChassisParameters.Initialize();
            var engineFilePointer = new FileOpener(ConfigManager.Settings.Contents.engineFilePath);

            if (engineFilePointer.Exists())
            {
                EngineSpec.SetEngineFile(engineFilePointer.absoluteFilepath);
            }
            else
            {
                MessageBox.Show("No engine files can be found. Horsepower and Torque settings will be inaccurate");
            }
            SPNDefinitions.Activate();      //in VMSpc/Parsers/J1939/SPNDefinitions.cs - Defines every SPN object
            //Odometer.Activate();
            //ParamData.Activate();
            TireManager.Initialize();
            CommunicationManager.Initialize();
            DayNightManager.Initialize();
        }
Exemple #16
0
    void UpdateLocalSFSUser()
    {
        //GameGUI.Inst.WriteToConsoleLog("UpdateLocalSFSUser() " + Time.time);

        List <UserVariable> userVariables = new List <UserVariable>();

        userVariables.Add(new SFSUserVariable("x", (double)localPlayer.gameObject.transform.position.x));
        userVariables.Add(new SFSUserVariable("y", (double)localPlayer.gameObject.transform.position.y));
        userVariables.Add(new SFSUserVariable("z", (double)localPlayer.gameObject.transform.position.z));
        userVariables.Add(new SFSUserVariable("rot", (double)localPlayer.gameObject.transform.rotation.eulerAngles.y));
        userVariables.Add(new SFSUserVariable("modelAnimation", (playerController != null) ? (int)playerController.playerState : 0));
        userVariables.Add(new SFSUserVariable("playerModel", (int)localPlayer.ModelIdx));
        userVariables.Add(new SFSUserVariable("op", localPlayer.GetAvatarOptionStr()));
        userVariables.Add(new SFSUserVariable("parseId", CommunicationManager.CurrentUserProfile.UserID));
        userVariables.Add(new SFSUserVariable("displayName", CommunicationManager.CurrentUserProfile.DisplayName));
        userVariables.Add(new SFSUserVariable("ptype", (int)localPlayer.Type));
        userVariables.Add(new SFSUserVariable("team", (int)localPlayer.TeamID));
        userVariables.Add(new SFSUserVariable("sit", localPlayer.IsSitting));

        Animator localAnimator = localPlayerGO.GetComponent <Animator>();

        if ((localAnimator != null) && (playerController != null))
        {
            float speed = playerController.moveSpeed;
            userVariables.Add(new SFSUserVariable("spd", (double)speed));
        }

        CommunicationManager.SendMsg(new SetUserVariablesRequest(userVariables));
    }
Exemple #17
0
    private void UpdateServerWithURL(string url)
    {
        List <RoomVariable> roomVariables = new List <RoomVariable>();

        roomVariables.Add(new SFSRoomVariable(roomVariableName, url));
        CommunicationManager.SendMsg(new SetRoomVariablesRequest(roomVariables, CommunicationManager.LastValidRoom()));
    }
 private void SliderUpdateInterval_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e)
 {
     if (CommunicationManager.Initialized)
     {
         CommunicationManager.ChangeStatusUpdateInterval(Convert.ToInt32(e.NewValue));
     }
 }
Exemple #19
0
    //----------------------------------------------------------
    // SmartFox callbacks
    //----------------------------------------------------------

    public void OnUserExitRoom(BaseEvent evt)
    {
        // Someone left - lets make certain they are removed if they didnt nicely send a remove command
        SFSUser user = (SFSUser)evt.Params["user"];
        Room    room = (Room)evt.Params["room"];

        Debug.LogError(user.Name + " left the room " + ((room != null) ? room.Name : ""));

        Player p = null;

        if (TryGetPlayer(user.Id, out p) && (GameManager.Inst.LocalPlayer == null || user.Name != GameManager.Inst.LocalPlayer.SFSName) && p.Type != PlayerType.STEALTH)
        {
            SoundManager.Inst.PlayExit();
        }

        if (room != null && p != null && CommunicationManager.IsPrivateRoom(room.Name))
        {
            GameGUI.Inst.ExecuteJavascriptOnGui(p.GetUserExitPrivateRoomJSCmd(room.Name));
        }

        if (!CommunicationManager.IsPrivateRoom(room.Name))
        {
            RemoveRemotePlayer(user);
        }
    }
Exemple #20
0
    public void UpdateServerRefreshMe()
    {
        ISFSObject productUpdateObj = CreateProductUpdateMessageWithID();

        productUpdateObj.PutBool("rp", true); // refresh product
        CommunicationManager.SendObjectMsg(productUpdateObj);
    }
Exemple #21
0
 public void switchOff(CommunicationManager comm)
 {
     comm.OpenPort();
     comm.WriteData(switchOffSignal);
     isSwitchedOn = false;
     //inicomm.ClosePort();
 }
 public SystemViewModel(CommunicationManager communicationManager)
 {
     this.communicationManager = communicationManager ?? throw new ArgumentNullException(nameof(communicationManager));
     this.communicationManager
     .WhenAnyValue(e => e.YepConnected, state => state ? "Green" : "Red")
     .ToProperty(this, e => e.ConnectionStatus, out connectionStatus);
 }
Exemple #23
0
    private void UpdateServerPLC()
    {
        ISFSObject productUpdateObj = CreateProductUpdateMessageWithID();

        productUpdateObj.PutInt("plc", productLifeCycle); // product life cycle
        CommunicationManager.SendObjectMsg(productUpdateObj);
    }
Exemple #24
0
 /// <summary>
 /// Khởi tạo thông số để kết nối với đầu đọc thẻ
 /// </summary>
 /// <param name="com">Đối tượng xử lý các sự kiện liên quan đến cổng COM</param>
 /// <param name="displayWindow">Control dùng để hiển thị dữ liệu đọc vào từ đầu đọc</param>
 public static void InitializeCardReader(ref CommunicationManager com, Control displayWindow)
 {
     com                         = new CommunicationManager();
     com.BaudRate                = "9600";
     com.DataBits                = "8";
     com.Parity                  = "None";
     com.StopBits                = "1";
     com.DisplayWindow           = displayWindow;
     com.CurrentTransmissionType = CommunicationManager.TransmissionType.Text;
     try
     {
         string[] settings = File.ReadAllLines("settings.ini");
         for (int i = 0; i < settings.Length; i++)
         {
             if (settings[i].StartsWith("COMPort"))
             {
                 com.PortName = settings[i].Split('=')[1].Trim().ToUpper();
             }
         }
     }
     catch
     {
         com.PortName = "COM7";
         MessageBox.Show("Cổng COM của đầu đọc thẻ chưa được thiết lập!\nCổng mặc định (COM7) sẽ được sử dụng.", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
Exemple #25
0
        public FormView(CommunicationManager cm, FloadingForm list, FieldsManager fm, WorkflowManager wm, int n)
        {
            InitializeComponent();

            #region ProgressBar

            //
            // progressBar
            //
            this.progressBar           = new Mobile.ProgressBar(n);
            this.progressBar.BackColor = System.Drawing.Color.Black;
            this.progressBar.Location  = new System.Drawing.Point(0, 0);
            this.progressBar.Name      = "progressBar";
            this.progressBar.Size      = new System.Drawing.Size(240, 35);
            this.progressBar.TabIndex  = 0;
            this.progressBar.Text      = "progressBar1";
            this.progressBar.Load();
            this.Controls.Add(this.progressBar);

            #endregion

            fieldsManager        = fm;
            workflowManager      = wm;
            communicationManager = cm;
            menuList             = list;
            timer          = new Timer();
            timer.Interval = 1;
            timer.Tick    += new EventHandler(Timer_Tick);
            notification   = new Notification();
            //notification.BalloonChanged += new Microsoft.WindowsCE.Forms.BalloonChangedEventHandler(n_BalloonChanged);
            notification.Caption  = "Error";
            notification.Critical = true;
        }
Exemple #26
0
    private void UpdatePlayerServerVariable(bool sitting)
    {
        List <UserVariable> userVariables = new List <UserVariable>();

        userVariables.Add(new SFSUserVariable("sit", sitting));
        CommunicationManager.SendMsg(new SetUserVariablesRequest(userVariables));
    }
Exemple #27
0
        public FrmAjoutCampagne()
        {
            InitializeComponent();

            // remplissage de la liste d'agences qui font de l'événementiel
            List <Evenementiel> lesAgencesEvenementiel;

            lesAgencesEvenementiel        = EvenementielManager.GetInstance().GetEvenementiels();
            cbxEvenementiel.DisplayMember = "nom";
            cbxEvenementiel.ValueMember   = "id";
            cbxEvenementiel.DataSource    = lesAgencesEvenementiel;
            cbxEvenementiel.SelectedIndex = -1;

            // remplissage de la liste d'agences qui font de la communication
            List <Communication> lesAgencesCommunication;

            lesAgencesCommunication        = CommunicationManager.GetInstance().GetCommunications();
            cbxCommunication.DisplayMember = "nom";
            cbxCommunication.ValueMember   = "id";
            cbxCommunication.DataSource    = lesAgencesCommunication;
            cbxCommunication.SelectedIndex = -1;

            // remplissage de la liste des catégories de public
            List <CategPublic> lesCategsPublic;

            lesCategsPublic = CategPublicManager.GetInstance().GetCategsPublic();
            cbxCategPublic.DisplayMember = "libelle";
            cbxCategPublic.ValueMember   = "id";
            cbxCategPublic.DataSource    = lesCategsPublic;
            cbxCategPublic.SelectedIndex = -1;
        }
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     RestoreWindowPosition();
     CommunicationManager.Login();
     RestoreUserPreferences();
     CommunicationManager.UpdateStatus();
 }
Exemple #29
0
        static void Main(String[] args)
        {
            TestResources();
            ResourceManager.Instance.CallingAssembly = Assembly.GetExecutingAssembly();
            string appDir  = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase);
            string confDir = appDir + @"\Configuration";
            string dataDir = appDir + @"\" + Mobile.Properties.Resources.FormDataSetFolder;

            DirectoryInfo confInfo = new DirectoryInfo(confDir);

            if (!confInfo.Exists)
            {
                confInfo.Create();
            }

            DirectoryInfo dataInfo = new DirectoryInfo(dataDir);

            if (!dataInfo.Exists)
            {
                dataInfo.Create();
            }

            ConfigurationHelper  configuration        = new ConfigurationHelper(confDir + @"\configuration.xml");
            CommunicationManager communicationManager = new CommunicationManager(configuration.Configuration.Host, configuration.Configuration.Port);

            int    pid         = -1;
            String requestInfo = "";

            if (args.Length > 0)
            {
                requestInfo = args[0];
                pid         = (Int32)Registry.LocalMachine.OpenSubKey(@"Floading\MobileListener\ListenerPid\").GetValue("Pid");

                NotificationScreen notificationScreen = new NotificationScreen(configuration, requestInfo, pid, communicationManager);

                //Parse notification request
                String data = XmlConvert.DecodeName(requestInfo);
                using (StringReader reader = new StringReader(data))
                {
                    FormRequestInfo request = new XmlSerializer(typeof(FormRequestInfo)).Deserialize(reader) as FormRequestInfo;
                    if (communicationManager.GetFormInfo(request.CompilationRequestId) == null)
                    {
                        communicationManager.StoreFormInfo(new FormInfo()
                        {
                            RequestInfo = request, NotificationTime = request.Time, Source = request.From
                        });
                        notificationScreen.ShowNotification(request);
                        Application.Run(notificationScreen);
                    }
                    else
                    {
                        Application.Exit();
                    }
                }
            }
            else
            {
                Application.Run(new MainScreen(configuration, requestInfo, pid, communicationManager));
            }
        }
        /// <summary> send command queue constructor. </summary>
        /// <param name="communicationManager">The communication manager instance</param>
        /// <param name="sendBufferMaxLength">Length of the send buffer</param>
        public SendCommandQueue(CommunicationManager communicationManager, int sendBufferMaxLength)
        {
            MaxQueueLength = 5000;

            _communicationManager = communicationManager;
            _sendBufferMaxLength = sendBufferMaxLength;
        }
Exemple #31
0
    private void HideUser()
    {
        List <UserVariable> userVariables = new List <UserVariable>();

        userVariables.Add(new SFSUserVariable("ptype", (int)PlayerType.STEALTH));
        CommunicationManager.SendMsg(new SetUserVariablesRequest(userVariables));
    }
Exemple #32
0
        public void LogAccessToken(AccessTokenModel accessToken)
        {
            var apiUrl = baseRoute + "/logAccessToken";

            communicationManager = new CommunicationManager(ApplicationSettings.Token, AuthContext.Auth.Token.Token);
            communicationManager.Post <AccessTokenModel, int>(accessToken, apiUrl);
        }
Exemple #33
0
    private void UpdateServerFactoryCount()
    {
        ISFSObject productUpdateObj = CreateProductUpdateMessageWithID();

        productUpdateObj.PutInt("nf", NumFactories); // num factories
        CommunicationManager.SendObjectMsg(productUpdateObj);
    }
        private void startListener()
        {
            this.communicationManager = new CommunicationManager()
            {
                LocalAddress  = ConfigurationManager.AppSettings.Get("LocalAddress"),
                RemoteAddress = ConfigurationManager.AppSettings.Get("RemoteAddress"),
                LocalPort     = int.Parse(ConfigurationManager.AppSettings.Get("LocalPort")),
                RemotePort    = int.Parse(ConfigurationManager.AppSettings.Get("RemotePort")),
                TimeToLive    = int.Parse(ConfigurationManager.AppSettings.Get("TimeToLive"))
            };

            this.communicationManager.Start();

            byte[] bytesReceived = null;

            int bytesCount = -1;

            while (true)
            {
                bytesReceived = this.communicationManager.Receive(out bytesCount);

                if ((bytesCount > 0) && (bytesReceived != null) && (bytesReceived.Length > 0))
                {
                    DataIdentifier identifier = CommonUtility.BinaryDeserialize(bytesReceived) as DataIdentifier; //JsonUtility.JsonDeserialize(bytesReceived, typeof(DataIdentifier), null, null) as DataIdentifier;

                    DataPair pair = this.doAcquisition(identifier);

                    this.saveDataPair(pair);

                    Thread thread = new Thread(this.threadProcSafe);

                    thread.Start(pair);
                }
            }
        }
Exemple #35
0
 public void switchOn(CommunicationManager comm)
 {
     comm.OpenPort();
     comm.WriteData(switchOnSignal);
     //comm.ClosePort();
     isSwitchedOn = true;
 }
Exemple #36
0
        public NopsaImage(NOPSAImageHolder imgholder, CommunicationManager cm)
        {
            InitializeComponent();

            imageholder = imgholder;

            line.X1 = 0;
            line.X2 = Width;
            line.Y1 = Height - 1;
            line.Y2 = Height - 1;

            this.cm = cm;
        }
        private DateTime searchtb_timestamp = new DateTime(); //used to monitor last textchange event of text box

        #endregion Fields

        #region Constructors

        public SearchUserControl()
        {
            Thread.CurrentThread.Name = "GUI_THREAD";
            // this shuts up 'other thread accessing UI' type errors
            //System.Windows.Forms.Control.CheckForIllegalCrossThreadCalls = false;

            InitializeComponent();
            //this.searchTB.KeyDown += new System.Windows.Forms.KeyEventHandler(this.searchTB_OnKeyDownHandler);
            this.SizeChanged += new EventHandler(this.SearchUserControl_SizeChanged);

            cm = new CommunicationManager(this);

            searchtb_timestamp = DateTime.UtcNow;
        }
        static void Main(string[] args)
        {
            Console.Title = "Zargate RFID Keyboard Emulator";
            string comPort = "";
            CommunicationManager comm = new CommunicationManager(comPort);
            do
            {
                Console.WriteLine("Enter COM-port, e.g. COM4");
                comPort = Console.ReadLine();
                comm = new CommunicationManager(comPort);
            } while (!comm.OpenPort());
            while (true)
            {

            }
        }
        public ConfigModule(CommunicationManager communicationManager)
            : base(communicationManager)
        {
            this.currentWriteTransactions = new Dictionary<ushort, ConfigTransaction>();

            this.waitingForChecksum = new List<ushort>();

            this.firstTime = true;

            this.configUpdateTimer = new Timer()
            {
                //Interval = 1000 * 30,    // 30 seconds
                Interval = 1000 * 5,
                AutoReset = false,
            };
            this.configUpdateTimer.Elapsed += configUpdateTimer_Elapsed;

            //this.configUpdateTimer.Start();
        }
 public UserModule(CommunicationManager communicationManager)
     : base(communicationManager)
 {
     this.pendingRequests = new Dictionary<HomeDevice, TaskCompletionSource<bool>>();
 }
        public ModuleBase(CommunicationManager communicationManager)
        {
            this.communicationManager = communicationManager;

            this.Filter = this.ConfigureInputFilter();

            this.OutputParameters = this.ConfigureOutputParameters();
        }
Exemple #42
0
        /// <summary> Initialises this object. </summary>
        /// <param name="transport">   The transport layer. </param>
        /// <param name="fieldSeparator">   The field separator. </param>
        /// <param name="commandSeparator"> The command separator. </param>
        /// <param name="escapeCharacter">  The escape character. </param>
        /// <param name="sendBufferMaxLength"> The maximunm size of the send buffer</param>
        private void Init(ITransport transport, char fieldSeparator, char commandSeparator,
            char escapeCharacter, int sendBufferMaxLength)
        {
            _controlToInvokeOn = null;

            _receiveCommandQueue  = new ReceiveCommandQueue(DisposeStack, this);
            _communicationManager = new CommunicationManager(DisposeStack, transport, _receiveCommandQueue, commandSeparator, fieldSeparator, escapeCharacter);
            _sender               = new Sender(_communicationManager, _receiveCommandQueue);
            _sendCommandQueue     = new SendCommandQueue(DisposeStack, this, _sender, sendBufferMaxLength);

            _receiveCommandQueue.NewLineReceived += (o, e) => InvokeNewLineEvent(NewLineReceived, e);
            _sendCommandQueue.NewLineSent        += (o, e) => InvokeNewLineEvent(NewLineSent, e);

            _fieldSeparator = fieldSeparator;
            _commandSeparator = commandSeparator;
            PrintLfCr = false;

            Command.FieldSeparator = _fieldSeparator;
            Command.CommandSeparator = _commandSeparator;
            Command.PrintLfCr = PrintLfCr;

            Escaping.EscapeChars(_fieldSeparator, _commandSeparator, escapeCharacter);
            _callbackList = new Dictionary<int, MessengerCallbackFunction>();
            //CurrentSentLine = "";
            CurrentReceivedLine = "";
        }
        private readonly Object _sendCommandDataLock = new Object(); // The process serial data lock

        #endregion Fields

        #region Constructors

        public Sender(CommunicationManager communicationManager, ReceiveCommandQueue receiveCommandQueue)
        {
            _communicationManager = communicationManager;
            _receiveCommandQueue = receiveCommandQueue;
        }
        /// <summary> Initializes this object. </summary>
        /// <param name="transport">   The transport layer. </param>
        /// <param name="boardType"> Embedded Processor type. Needed to translate variables between sides. </param>
        /// <param name="fieldSeparator">   The field separator. </param>
        /// <param name="commandSeparator"> The command separator. </param>
        /// <param name="escapeCharacter">  The escape character. </param>
        /// <param name="sendBufferMaxLength"> The maximum size of the send buffer</param>
        private void Init(ITransport transport, BoardType boardType, char fieldSeparator, char commandSeparator,
                          char escapeCharacter, int sendBufferMaxLength)
        {           
            ControlToInvokeOn = null;

            //Logger.Open(@"sendCommands.txt");
            Logger.DirectFlush = true;

            _receiveCommandQueue = new ReceiveCommandQueue(HandleMessage);
            _communicationManager = new CommunicationManager(transport, _receiveCommandQueue, boardType, commandSeparator, fieldSeparator, escapeCharacter);
            _sendCommandQueue = new SendCommandQueue(_communicationManager, sendBufferMaxLength);

            PrintLfCr = false;

            _receiveCommandQueue.NewLineReceived += (o, e) => InvokeNewLineEvent(NewLineReceived, e);
            _sendCommandQueue.NewLineSent        += (o, e) => InvokeNewLineEvent(NewLineSent, e);

            Escaping.EscapeChars(fieldSeparator, commandSeparator, escapeCharacter);
            _callbackList = new Dictionary<int, MessengerCallbackFunction>();

            _sendCommandQueue.Start();
            _receiveCommandQueue.Start();
        }
 public NetworkJoin(CommunicationManager manager)
     : base(manager)
 {
     this.PendingNodes = new List<PendingNodeInfo>();
 }
Exemple #46
0
        /// <summary> Initialises this object. </summary>
        /// <param name="transport">   The transport layer. </param>
        /// <param name="fieldSeparator">   The field separator. </param>
        /// <param name="commandSeparator"> The command separator. </param>
        /// <param name="escapeCharacter">  The escape character. </param>
        private void Init(ITransport transport, char fieldSeparator, char commandSeparator,
                          char escapeCharacter)
        {
            _controlToInvokeOn = null;

            _sendCommandQueue = new SendCommandQueue(DisposeStack, this);
            _receiveCommandQueue = new ReceiveCommandQueue(DisposeStack, this);
            _communicationManager = new CommunicationManager(DisposeStack, transport, _receiveCommandQueue, commandSeparator, fieldSeparator, escapeCharacter);

            _fieldSeparator = fieldSeparator;
            _commandSeparator = commandSeparator;

            Escaping.EscapeChars(fieldSeparator, commandSeparator, escapeCharacter);
            _callbackList = new Dictionary<int, MessengerCallbackFunction>();
            PrintLfCr = false;
        }