コード例 #1
0
        // called from TrackRoamerBrickProximityBoardService:
        public ProximityBoardCcrServiceCommander(DispatcherQueue dispatcherQueue, PBCommandPort uplinkPort, Int32 vendorId, Int32 productId)
            : base(dispatcherQueue)
        {
            Tracer.Trace(string.Format("ProximityBoardCcrServiceCommander::ProximityBoardCcrServiceCommander() vendorId = 0x{0:X} productId = 0x{0:X}", vendorId, productId));

            _pbCommanderDataEventsPort = uplinkPort;

            _pmManager = new ProximityBoardManager(dispatcherQueue, vendorId, productId);

            _pmManager.PicPxMod.DeviceAttachedEvent += new EventHandler <ProximityModuleEventArgs>(picpxmod_DeviceAttachedEvent);
            _pmManager.PicPxMod.DeviceDetachedEvent += new EventHandler <ProximityModuleEventArgs>(picpxmod_DeviceDetachedEvent);

            _pmManager.Start();

            Activate <ITask>(
                Arbiter.Receive <SonarData>(true, _pmManager.MeasurementsPort, SonarDataHandler),
                Arbiter.Receive <DirectionData>(true, _pmManager.MeasurementsPort, DirectionDataHandler),
                Arbiter.Receive <AccelerometerData>(true, _pmManager.MeasurementsPort, AccelerometerDataHandler),
                Arbiter.Receive <ProximityData>(true, _pmManager.MeasurementsPort, ProximityDataHandler),
                Arbiter.Receive <ParkingSensorData>(true, _pmManager.MeasurementsPort, ParkingSensorDataHandler),
                Arbiter.Receive <AnalogData>(true, _pmManager.MeasurementsPort, AnalogDataHandler),
                Arbiter.Receive <Exception>(true, _pmManager.MeasurementsPort, ExceptionHandler)
                );
        }