コード例 #1
0
 private void OnBufferReceived(WS4000Buffer theBuffer)
 {
     if (BufferReceived != null)
     {
         BufferReceived(this, new BufferReceivedEventArgs(theBuffer));
     }
 }
コード例 #2
0
ファイル: WS4000Buffer.cs プロジェクト: JoostZ/weather-logger
 /// <summary>
 /// Copy Constructort
 /// </summary>
 /// <param name="from">The buffer to copy</param>
 public WS4000Buffer(WS4000Buffer from)
     : this(from.Offset, from.Size)
 {
     for (int i = 0; i < from.Size; i++)
     {
         Buffer[i] = from.Buffer[i];
     }
 }
コード例 #3
0
 /// <summary>
 /// Copy Constructort
 /// </summary>
 /// <param name="from">The buffer to copy</param>
 public WS4000Buffer(WS4000Buffer from)
     : this(from.Offset, from.Size)
 {
     for (int i = 0; i < from.Size; i++)
     {
         Buffer[i] = from.Buffer[i];
     }
 }
コード例 #4
0
        /// <summary>
        /// Start the reading of a 32 byte part of the WS4000 memory starting
        /// at address offset
        /// </summary>
        /// <param name="offset"></param>
        public void getMemory(int offset, int length = 0x20)
        {
            if (Buffer != null)
            {
                throw new HIDDeviceException("Reading memory is in progress");
            }

            Buffer = new WS4000Buffer(offset, length);
            RequestBuffer request = new RequestBuffer(this);

            request.Offset = offset;
            request.Send();
        }
コード例 #5
0
        /// <summary>
        /// Handle the received global data
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        void GlobalBufferRead(object sender, BufferReceivedEventArgs args)
        {
            this.BufferReceived -= GlobalBufferRead;
            byte[] globalBuffer = args.Data.Buffer;
            Count        = ToUShort(globalBuffer, DATA_COUNT) - 1; // The active buffer is also in Count
            SnapshotDate = toDateTime(globalBuffer, DATE_TIME);
            ushort pos = ToUShort(globalBuffer, CURRENT_POS);

            CurrentPos    = new BufferPos(pos);
            CurrentBuffer = null;

            this.BufferReceived += ActiveSnapshotRead;
            GetBlock(CurrentPos);
        }
コード例 #6
0
 void handleInputReport(object sender, DataReceivedEventArgs args)
 {
     if (Buffer != null)
     {
         Buffer.add(args.data.Buffer);
         if (Buffer.Full)
         {
             WS4000Buffer buffer = Buffer;
             Buffer = null;
             OnBufferReceived(buffer);
         }
         else if (Buffer.Cursor % 0x20 == 0)
         {
             RequestBuffer request = new RequestBuffer(this);
             request.Offset = Buffer.Cursor;
             request.Send();
         }
     }
 }
コード例 #7
0
 public BufferReceivedEventArgs(WS4000Buffer data)
 {
     this.data = data;
 }
コード例 #8
0
 void HandleBufferReceived(object sender, BufferReceivedEventArgs args)
 {
     CurrentBuffer = WS4000Buffer.Clone(args.Data);
     OnBufferReceived(CurrentBuffer);
 }
コード例 #9
0
ファイル: WS4000Device.cs プロジェクト: JoostZ/weather-logger
 void handleInputReport(object sender, DataReceivedEventArgs args)
 {
     if (Buffer != null)
     {
         Buffer.add(args.data.Buffer);
         if (Buffer.Full)
         {
             WS4000Buffer buffer = Buffer;
             Buffer = null;
             OnBufferReceived(buffer);
         }
         else if (Buffer.Cursor % 0x20 == 0)
         {
             RequestBuffer request = new RequestBuffer(this);
             request.Offset = Buffer.Cursor;
             request.Send();
         }
     }
 }
コード例 #10
0
ファイル: WS4000Device.cs プロジェクト: JoostZ/weather-logger
        /// <summary>
        /// Start the reading of a 32 byte part of the WS4000 memory starting
        /// at address offset
        /// </summary>
        /// <param name="offset"></param>
        public void getMemory(int offset, int length = 0x20)
        {
            if (Buffer != null)
            {
                throw new HIDDeviceException("Reading memory is in progress");
            }

            Buffer = new WS4000Buffer(offset, length);
            RequestBuffer request = new RequestBuffer(this);
            request.Offset = offset;
            request.Send();
        }
コード例 #11
0
ファイル: WS4000Device.cs プロジェクト: JoostZ/weather-logger
 public BufferReceivedEventArgs(WS4000Buffer data)
 {
     this.data = data;
 }
コード例 #12
0
ファイル: WS4000Device.cs プロジェクト: JoostZ/weather-logger
 private void OnBufferReceived(WS4000Buffer theBuffer)
 {
     if (BufferReceived != null)
     {
         BufferReceived(this, new BufferReceivedEventArgs(theBuffer));
     }
 }
コード例 #13
0
ファイル: WS4000Buffer.cs プロジェクト: JoostZ/weather-logger
 public static WS4000Buffer Clone(WS4000Buffer from)
 {
     return new WS4000Buffer(from);
 }
コード例 #14
0
 public static WS4000Buffer Clone(WS4000Buffer from)
 {
     return(new WS4000Buffer(from));
 }