コード例 #1
0
ファイル: WidcommBtIf.cs プロジェクト: zhubin-12/32feet
        //-------------
        public bool GetLocalDeviceVersionInfo(ref DEV_VER_INFO devVerInfo)
        {
            int  cb      = Marshal.SizeOf(devVerInfo);
            bool success = NativeMethods.BtIf_GetLocalDeviceVersionInfo(m_pBtIf,
                                                                        ref devVerInfo, cb);

            return(success);
        }
コード例 #2
0
        internal WidcommBluetoothRadio(WidcommBluetoothFactoryBase factory)
        {
            System.Threading.ThreadStart handleError = delegate { };
#if !NETCF
            // On my old iPAQ the radio info functions fail sometimes even though
            // the stack is working fine so we ignored the errors in the first
            // release.  On Win32 this is a problem when the stack is installed
            // but no radio is attached, so fail in that case.
            handleError = delegate {
                throw new PlatformNotSupportedException(
                          "Widcomm Bluetooth stack not supported (Radio).");
            };
#endif
            //
            Debug.Assert(factory != null);
            _factory = factory;
            var  tmp = BtIf;
            bool ret;
            ret = BtIf.GetLocalDeviceVersionInfo(ref m_dvi);
            Debug.Assert(ret, "GetLocalDeviceVersionInfo failed");
            if (!ret)
            {
                handleError();
                // Call handleError first so that one Win32 we don't get the Assert if there's no stack present.
                Debug.Assert(ret, "GetLocalDeviceVersionInfo failed");
                m_dvi = new DEV_VER_INFO(HciVersion.Unknown); // Reset to overwrite any garbage returned by GetLocalDeviceVersionInfo.
            }
            byte[] bdName = new byte[WidcommStructs.BD_NAME_LEN];
            ret = BtIf.GetLocalDeviceName(bdName);
            Debug.Assert(ret, "GetLocalDeviceName failed");
            if (ret)
            {
                m_name = WidcommUtils.BdNameToString(bdName);
            }
            else
            {
                bdName = null;
                handleError();
            }
            //
            // Did GetLocalDeviceVersionInfo get the address?  It doesn't work on
            // my iPAQ, but then again this way doesn't work either!
            if (LocalAddress == null || LocalAddress.ToInt64() == 0)
            {
                Utils.MiscUtils.Trace_WriteLine("GetLocalDeviceVersionInfo's bd_addr is empty, trying GetLocalDeviceInfoBdAddr...");
                if (m_dvi.bd_addr == null)
                {
                    m_dvi.bd_addr = new byte[WidcommStructs.BD_ADDR_LEN];
                }
                ret = BtIf.GetLocalDeviceInfoBdAddr(m_dvi.bd_addr);
                Debug.Assert(ret, "GetLocalDeviceInfoBdAddr failed");
                if (!ret)
                {
                    m_dvi.bd_addr = new byte[WidcommStructs.BD_ADDR_LEN];
                    handleError();
                }
            }
        }
コード例 #3
0
ファイル: WidcommBtInterface.cs プロジェクト: jehy/32feet.NET
 //----------
 internal bool GetLocalDeviceVersionInfo(ref DEV_VER_INFO m_dvi)
 {
     return(m_btIf.GetLocalDeviceVersionInfo(ref m_dvi));
 }
コード例 #4
0
 public bool GetLocalDeviceVersionInfo(ref DEV_VER_INFO devVerInfo)
 {
     return(_child.GetLocalDeviceVersionInfo(ref devVerInfo));
 }
コード例 #5
0
ファイル: WidcommBtIf.cs プロジェクト: zhubin-12/32feet
 internal static extern bool BtIf_GetLocalDeviceVersionInfo(IntPtr pObj,
                                                            ref DEV_VER_INFO pBuf, int cb);