public WinBtStream(string path, BtStack btStack) : this(path)
 {
     if (btStack == BtStack.Toshiba)
     {
         UseFullReportSize = true;
         UseWriteFile      = true;
     }
 }
Example #2
0
        public BT()
        {
            try
            {
                //Get new Stack object
                btStack = new BtStack();

                //Connect to bluetooth radio
                //ShowFcnResult("StackConnect", btStack.Connect());

                Devices        = new Queue <BtDevice>();
                DeviceNames    = new Queue <string>();
                SearchComplete = false;
            }
            catch (Exception Ex)
            {
                MessageBox.Show(Ex.Message);
            }
        }
Example #3
0
        public BT(ListBox lb)
        {
            lstResults = lb;
            try
            {
                //Get new Stack object
                btStack = new BtStack();

                //Connect to bluetooth radio
                //ShowFcnResult("StackConnect", btStack.Connect());

                Devices     = new Queue <BtDevice>();
                DeviceNames = new Queue <string>();
            }
            catch (Exception Ex)
            {
                MessageBox.Show(Ex.Message);
                Application.Exit();
            }
        }
Example #4
0
        public BT()
        {
            try
            {
                //Get new Stack object
                btStack = new BtStack();

                //Connect to bluetooth radio
                //ShowFcnResult("StackConnect", btStack.Connect());

                Devices = new Queue<BtDevice>();
                DeviceNames = new Queue<string>();
                SearchComplete = false;

            }
            catch (Exception Ex)
            {
                MessageBox.Show(Ex.Message);

            }
        }
Example #5
0
        public BT(ListBox lb)
        {
            lstResults = lb;
            try
            {
                //Get new Stack object
                btStack = new BtStack();

                //Connect to bluetooth radio
                //ShowFcnResult("StackConnect", btStack.Connect());

                Devices = new Queue<BtDevice>();
                DeviceNames = new Queue<string>();

            }
            catch (Exception Ex)
            {
                MessageBox.Show(Ex.Message);
                Application.Exit();

            }
        }
Example #6
0
        public static BtStack CheckBtStack(SP_DEVINFO_DATA data)
        {
            // Assume it is the Microsoft Stack
            BtStack         resultStack      = BtStack.Microsoft;
            IntPtr          parentDeviceInfo = IntPtr.Zero;
            SP_DEVINFO_DATA parentData       = new SP_DEVINFO_DATA();

            parentData.cbSize = (uint)Marshal.SizeOf(typeof(SP_DEVINFO_DATA));

            int status     = 0;
            int problemNum = 0;

            var result = CM_Get_DevNode_Status(ref status, ref problemNum, (int)data.DevInst, 0);

            if (result != 0)
            {
                return(resultStack);             // Failed
            }
            uint parentDevice;

            result = CM_Get_Parent(out parentDevice, data.DevInst, 0);

            if (result != 0)
            {
                return(resultStack);             // Failed
            }
            char[] parentId = new char[200];

            result = CM_Get_Device_ID(parentDevice, parentId, 200, 0);

            if (result != 0)
            {
                return(resultStack);             // Failed
            }
            string id = new string(parentId).Replace("\0", "");

            Guid g = Guid.Empty;

            HidD_GetHidGuid(out g);
            parentDeviceInfo = SetupDiCreateDeviceInfoList(ref g, IntPtr.Zero);

            // TODO: This fails, something not right
            bool success = SetupDiOpenDeviceInfo(parentDeviceInfo, id, IntPtr.Zero, 0, ref parentData);

            if (success)
            {
                int   requiredSize = 0;
                ulong devicePropertyType;

                DEVPROPKEY requestedKey = new DEVPROPKEY();
                requestedKey.fmtid = new Guid(0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6);
                requestedKey.pid   = 9;

                SetupDiGetDeviceProperty(parentDeviceInfo, parentData, requestedKey, out devicePropertyType, null, 0, out requiredSize, 0);

                char[] buffer = new char[requiredSize];
                success = SetupDiGetDeviceProperty(parentDeviceInfo, parentData, requestedKey, out devicePropertyType, buffer, requiredSize, out requiredSize, 0);

                if (success)
                {
                    string classProvider = new string(buffer);
                    classProvider = classProvider.Replace("\0", "");
                    if (classProvider == "TOSHIBA")
                    {
                        // Toshiba Stack
                        resultStack = BtStack.Toshiba;
                    }
                }

                SetupDiDestroyDeviceInfoList(parentDeviceInfo);
            }
            else
            {
                var error = GetLastError();
                SetupDiDestroyDeviceInfoList(parentDeviceInfo);
            }

            return(resultStack);
        }
Example #7
0
 public WinBtStream(string path, BtStack btStack, FileShare sharingMode) : this(path, btStack)
 {
     SharingMode = sharingMode;
 }