Exemplo n.º 1
0
 /// <summary>
 /// Initialises a ProductCatalogue
 /// </summary>
 /// <param name="prodId">The ID of the product.</param>
 /// <param name="prodVersion">The current version of the product.</param>
 public ProductCatalogue(CANClient can, byte prodId, byte prodVersion, DeviceCatalogueInfo.EquipmentFlages mask, DeviceCatalogueInfo.EquipmentFlages state)
 {
     mMask           = mask;
     mStatus         = state;
     mCatalogueFrame = CNXCANMsgHelper.PackProductId(prodId, prodVersion, (uint)mask, (uint)state);
     _ProductCatalogue(can);
 }
Exemplo n.º 2
0
 /// <summary>
 /// Initialises a ProductCatalogue from a file.
 /// </summary>
 /// <param name="path">Path to product file.</param>
 /// <remarks>
 /// The file should be a text file with seperate lines containing the product Id and the version.
 /// The lines should be space seperated key value pairs as below.
 /// PRODUCT_ID 2
 /// VERSION 4
 /// </remarks>
 public ProductCatalogue(CANClient can, string path, DeviceCatalogueInfo.EquipmentFlages mask, DeviceCatalogueInfo.EquipmentFlages state)
 {
     mMask           = mask;
     mStatus         = state;
     mCatalogueFrame = PopulateProductFrameFromFile(path, mask, state);
     _ProductCatalogue(can);
 }
Exemplo n.º 3
0
        /// <summary>
        /// Initialise a BlockReceiver.
        /// </summary>
        /// <param name="blockId">Id of the blocks to be processed.</param>
        /// <param name="version">Current product version.</param>
        /// <param name="client">The CAN client to use for frame transferes.</param>
        /// <param name="initBlockSize">Initial amount of memory to reserve for the block.</param>
        public BaseBlockReciever(int blockId, int version, CANClient client, uint initBlockSize)
        {
            // initialise ID
            mBlockId = (byte)(blockId & 0xff);
            // product version
            mProdVersion = (byte)(version & 0xff);

            // subscribe to frame events
            mClient = client;
            mClient.RaiseFrameReceivedEvent += FrameReceivedEventHandler;

            // create a stream for the block
            CreateMemoryStream(initBlockSize);
        }
Exemplo n.º 4
0
        public CANCommsServer(CANClient client, NMEAGPSClient.NMEAGPSClient gpsClient)
        {
            mCANClient = client;
            mGpsClient = gpsClient;

            // make a device catalogue
            mDeviceCatalogue = CreateCatalogue(TrackingService.VarPath + mCatalogueFilename);

            // start time for cataloge and status reporting
            mCatalogueTimer = new Timer(OnTimedEvent, null, CatalogueTime, CatalogueTime);

            // subscribe to gps events
            mGpsClient.RaiseGPSPositionChangedEvent += GPSPositionChangedEventHandler;
            // get the current gps status
            mGPSStatus = mGpsClient.Status;
            mGpsClient.RaiseGPSStatusChangedEvent += GPSStatusChangedEventHandler;

            // subscribe to CAN frame events
            mCANClient.RaiseFrameReceivedEvent += FrameReceivedEventHandler;
        }
Exemplo n.º 5
0
        /// <summary>
        /// Initialise a BlockReceiver from a block frame.
        /// </summary>
        /// <param name="frame"></param>
        /// <param name="version">Current product version.</param>
        /// <param name="client">The CAN client to use for frame transferes.</param>
        public BaseBlockReciever(CANLib.CANFrame frame, int version, CANNativeClient client)
        {
            // initialise ID
            mBlockId = (byte)(frame.MailboxId & 0xff);
            // product version
            mProdVersion = (byte)(version & 0xff);

            // subscribe to frame events
            if (client != null)
            {
                mClient = client;
            }
            else
            {
                mClient = new CANNativeClient("can0");
            }
            mClient.RaiseFrameReceivedEvent += FrameReceivedEventHandler;

            // create a stream for the block
            CreateMemoryStream();

            ProcessChunk(frame);
        }
Exemplo n.º 6
0
 public TransientBlockReciever(int blockId, CANClient client) : base(blockId, 0, client, 200)
 {
 }
Exemplo n.º 7
0
 /// <summary>
 /// Initialise a BlockReceiver.
 /// </summary>
 /// <param name="blockId">Id of the blocks to be processed.</param>
 /// <param name="version">Current product version.</param>
 /// <param name="client">The CAN client to use for frame transferes.</param>
 public BlockReciever(int blockId, int version, CANClient client) : base(blockId, version, client)
 {
     mVersionTimer = new System.Threading.Timer(new TimerCallback(OnTimedEvent), null, 60 * 1000, 60 * 1000);
 }
Exemplo n.º 8
0
 private void _ProductCatalogue(CANClient can)
 {
     mCANClient = can;
     // start time for cataloge and status reporting
     mCatalogueTimer = new System.Threading.Timer(new TimerCallback(OnTimedEvent), null, 60 * 1000, 60 * 1000);
 }