static void DoTest(bool?reportAllErrors, bool?oneStackOnly, string xmlContent) { BluetoothFactoryConfig.Values v = new BluetoothFactoryConfig.Values(); using (TextReader rdr = new StringReader(xmlContent)) { BluetoothFactoryConfig.LoadManually(rdr, v); } Assert.AreEqual(oneStackOnly, v.oneStackOnly, "oneStackOnly"); Assert.AreEqual(reportAllErrors, v.reportAllErrors, "reportAllErrors"); }
internal BluetopiaFactory(IBluetopiaApi api, IBluetopiaSecurity optionalSecurityInstance) { if (api == null) { throw new ArgumentNullException("api"); } _api = api; // _inquiryHandler = new BluetopiaInquiry(this); _inquiryEventCallback = _inquiryHandler.HandleInquiryEvent; _HandleNameLookup = HandleNameLookup; // //int handle = _api.BSC_Initialize((byte[])InitData.Clone(), 0); Utils.MiscUtils.Trace_WriteLine( "Calling BSC_Initialize with:" + InitData2.ToString()); int handle = _api.BSC_Initialize(ref InitData2, 0); //TEST--CheckStructBytes(ref InitData2, (byte[])InitData.Clone()); var ret = (BluetopiaError)handle; if (!BluetopiaUtils.IsSuccessZeroIsIllegal(ret)) { KillBtExplorerExe(); // Since one app at a time! // _Quickly_ try to init, as BTExplorer.exe restarts automatically! handle = _api.BSC_Initialize(ref InitData2, 0); ret = (BluetopiaError)handle; } if (!BluetopiaUtils.IsSuccessZeroIsIllegal(ret)) { Utils.MiscUtils.Trace_WriteLine("Stonestreet One Bluetopia failed to init: " + BluetopiaUtils.ErrorToString(ret)); } BluetopiaUtils.CheckAndThrowZeroIsIllegal(ret, "BSC_Initialize"); _stackId = checked ((uint)handle); // if (optionalSecurityInstance != null) { _sec = optionalSecurityInstance; } else { _sec = new BluetopiaSecurity(this); } _sec.InitStack(); // // var packetDebug = false; var eap = BluetoothFactoryConfig.GetEntryAssemblyPath(); if (eap != null) // null if we're under unit-test or... { var dir = Path.GetDirectoryName(eap); var filename = Path.Combine(dir, "DoPacketDebug.txt"); if (File.Exists(filename)) { packetDebug = true; } } if (packetDebug) { _pdebug = new BluetopiaPacketDebug(this); } // InitApiVersion(); }