예제 #1
0
        //--------
        //-------- Constructors
        //--------

        /// <summary>
        /// Constructs a new u packet builder.
        /// </summary>
        /// <param name="startUState">   the object that contains the U brick state
        ///                        which is reference when creating packets </param>
        public UPacketBuilder(UAdapterState startUState)
        {
            // get a reference to the U state
            uState = startUState;

            // create the buffer for the data
            packet = new RawSendPacket();

            // create the vector
            packetsVector = new List <RawSendPacket>();

            // restart the packet to initialize
            restart();

            // no bit banging supported
            bitsOnly = false;

            // check for a bits only property
            string bits = OneWireAccessProvider.getProperty("onewire.serial.forcebitsonly");

            if (!string.ReferenceEquals(bits, null))
            {
                if (bits.IndexOf("true", StringComparison.Ordinal) != -1)
                {
                    bitsOnly = true;
                }
                else if (bits.IndexOf("false", StringComparison.Ordinal) != -1)
                {
                    bitsOnly = false;
                }
            }
        }
예제 #2
0
        /// <summary>
        /// Take the current packet and place it into the vector.  This
        /// indicates a place where we need to wait for the results from
        /// DS9097U adapter.
        /// </summary>
        public virtual void newPacket()
        {
            // add the packet
            packetsVector.Add(packet);

            // get a new packet
            packet = new RawSendPacket();
        }
예제 #3
0
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (packet != null)
         {
             packet.Dispose();
             packet = null;
         }
     }
 }
예제 #4
0
        //--------
        //-------- Constructors
        //--------

        /// <summary>
        /// Constructs a new USB packet builder.
        /// </summary>
        /// <param name="startUState">   the object that contains the DS2490 state
        ///                        which is reference when creating packets </param>
        public UsbPacketBuilder(UsbAdapterState startUState)
        {
            // get a reference to the USB adapter state
            UsbState = startUState;

            // create the buffer for the data
            packet = new RawSendPacket();

            // create the vector
            packetsVector = new List <RawSendPacket>();

            // restart the packet to initialize
            restart();
        }