Пример #1
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);
        }
Пример #2
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 BlockReciever(CANLib.CANFrame frame, int version, CANNativeClient client) : base(frame, version, client)
 {
     mVersionTimer = new System.Threading.Timer(new TimerCallback(OnTimedEvent), null, 60 * 1000, 60 * 1000);
 }