예제 #1
0
        void ReplaceHandler(Replace replace)
        {
            Tracer.Trace("SickLRF::ReplaceHandler()");

            _state = replace.Body;
            replace.ResponsePort.Post(DefaultReplaceResponseType.Instance);
        }
예제 #2
0
        /// <summary>
        /// Send phase of construction.
        /// </summary>
        protected override void Start()
        {
            if (_state == null)
            {
                _state = new State();
            }

            Tracer.Trace("SickLRF::Start()");

            LogInfo("Start");

            _httpUtilities = DsspHttpUtilitiesService.Create(Environment);

            //
            // Kick off the connection to the Laser Range Finder device.
            //
            SpawnIterator(0, _state.ComPort, StartLRF);

            // This service does not use base.Start() because of the way that
            // the handlers are hooked up. Also, because of this, there are
            // explicit Get and HttpGet handlers instead of using the default ones.
            // Handlers that need write or Exclusive access to state go under
            // the Exclusive group. Handlers that need read or shared access, and can be
            // Concurrent to other readers, go to the Concurrent group.
            // Other internal ports can be included in interleave so you can coordinate
            // intermediate computation with top level handlers.
            Activate(
                Arbiter.Interleave(
                new TeardownReceiverGroup(
                    Arbiter.Receive<DsspDefaultDrop>(false, _mainPort, DropHandler)
                    ),
                new ExclusiveReceiverGroup(
                    Arbiter.Receive<Replace>(true, _mainPort, ReplaceHandler),
                    Arbiter.Receive<LinkMeasurement>(true, _internalPort, MeasurementHandler),
                    Arbiter.ReceiveWithIterator<LinkPowerOn>(true, _internalPort, PowerOn),
                    Arbiter.ReceiveWithIterator<Exception>(true, _internalPort, ExceptionHandler)),
                new ConcurrentReceiverGroup(
                    Arbiter.Receive<DsspDefaultLookup>(true, _mainPort, DefaultLookupHandler),
                    Arbiter.ReceiveWithIterator<Subscribe>(true, _mainPort, SubscribeHandler),
                    Arbiter.ReceiveWithIterator<ReliableSubscribe>(true, _mainPort, ReliableSubscribeHandler),
                    Arbiter.Receive<Get>(true, _mainPort, GetHandler),
                    Arbiter.Receive<HttpGet>(true, _mainPort, HttpGetHandler),
                    Arbiter.Receive<Reset>(true, _mainPort, ResetHandler))
                )
            );

            DirectoryInsert();
        }
예제 #3
0
        public PacketBuilder()
        {
            Tracer.Trace("PacketBuilder::PacketBuilder()");

            _dropped = 0;
            _total = 0;
            _state = State.STX;
            _missedFirst = false;
            _badCount = 0;
        }