public async Task GetAllDevices_ManufacturerData_Null() { var adapterName = "adapter"; var address = "11:22:33:44:55:66"; var name = "some device name"; ManufacturerData manufacturerData = null; var btServiceMock = new Mock <IBluetoothService>(); var btAdapterMock = new Mock <IBluetoothAdapter>(); var btDeviceMock = new Mock <IBluetoothDevice>(); var btPropertiesMock = new Mock <IBluetoothDeviceProperties>(); var sourceDeviceList = new List <IBluetoothDevice>() { btDeviceMock.Object }; btPropertiesMock.Setup(p => p.Address).Returns(address); btPropertiesMock.Setup(p => p.Name).Returns(name); btPropertiesMock.Setup(p => p.GetManufacturerData()).Returns(manufacturerData); btDeviceMock.Setup(d => d.GetPropertiesAsync()).ReturnsAsync(btPropertiesMock.Object); btAdapterMock.Setup(a => a.GetDevicesAsync()).ReturnsAsync(sourceDeviceList); btServiceMock.Setup(s => s.GetAdapterAsync(adapterName)).ReturnsAsync(btAdapterMock.Object); var bleReader = new BleReader(btServiceMock.Object); await bleReader.ScanAsync(adapterName, 0); var deviceInfoList = await bleReader.GetAllDevicesAsync(); Assert.AreEqual(sourceDeviceList.Count, deviceInfoList.Count, "Scanning did take expected time"); Assert.AreEqual(name, deviceInfoList[0].Name, "Name is not correct"); Assert.AreEqual(address, deviceInfoList[0].Address, "Address is not correct"); Assert.IsNull(manufacturerData, "Manufacturer data should be null"); }
private IDictionary <string, IDictionary <string, object> > GetProperties() { Dictionary <string, IDictionary <string, object> > response = new Dictionary <string, IDictionary <string, object> >(); Dictionary <string, object> inner = new Dictionary <string, object>(); inner["Type"] = Type; if (ServiceUUIDs.Any()) { inner["ServiceUUIDs"] = ServiceUUIDs.ToArray(); } if (SolicitUUIDs.Any()) { inner["SolicitUUIDs"] = SolicitUUIDs.ToArray(); } if (ManufacturerData.Any()) { inner["ManufacturerData"] = ManufacturerData; } if (ServiceData.Any()) { inner["ServiceData"] = ServiceData; } inner["IncludeTxPower"] = IncludeTxPower; response[typeof(LEAdvertisement1).DBusInterfaceName()] = inner; return(response); }
public AdvertisementData(SR result) { this.result = result; this.manufacturerData = new Lazy <ManufacturerData[]>(() => { var md = this.result.ScanRecord.ManufacturerSpecificData; var mdata = new ManufacturerData[md.Size()]; //for (var i = 0; i < md.Size(); i++) //{ // var companyId = mdata.KeyAt(i); // mdata[i] = null; //} return(mdata); }); this.serviceUuids = new Lazy <Guid[]>(() => result .ScanRecord .ServiceUuids? .Select(x => x.Uuid.ToGuid()) .ToArray() ); this.serviceData = new Lazy <AdvertisementServiceData[]>(() => result .ScanRecord .ServiceData .Select(x => new AdvertisementServiceData(x.Key.Uuid.ToGuid(), x.Value)) .ToArray() ); }
public List <ReadableSale> GetSpecificWordGroup(string customer, string manufacturer, string keywords, int staff_Id, string helper, DateTime salesOrderStartDate, DateTime salesOrderEndDate, DateTime salesStartDate, DateTime salesEndDate) { using (DefaultConnection db = new DefaultConnection()) { SQLWhereString whereString = new SQLWhereString(); string where = whereString.SearchKeyWhere <ReadableSale>(db, keywords); int openCustomer_Id = BusinessPartnerData.NameToId(db, customer)[0]; int closeCustomer_Id = BusinessPartnerData.NameToId(db, customer)[1]; int openManufacturer_Id = ManufacturerData.NameToId(db, manufacturer)[0]; int closeManufacturer_Id = ManufacturerData.NameToId(db, manufacturer)[1]; int openStaff_Id = StaffData.GetIdRange(db, staff_Id)[0]; int closeStaff_Id = StaffData.GetIdRange(db, staff_Id)[1]; int openHelper_Id = HelperData.NameToId(db, helper)[0]; int closeHelper_Id = HelperData.NameToId(db, helper)[1]; List <ReadableSale> readableSales = new List <ReadableSale>(); if (!String.IsNullOrEmpty(keywords)) { readableSales = db.Database .SqlQuery <ReadableSale>(where) .ToList(); return(readableSales .Where(rs => rs.Customer_Id >= openCustomer_Id && rs.Customer_Id <= closeCustomer_Id && rs.Manufacturer_Id >= openManufacturer_Id && rs.Manufacturer_Id <= closeManufacturer_Id && rs.ResponsibleStaff_Id >= openStaff_Id && rs.ResponsibleStaff_Id <= closeStaff_Id && rs.Helper_Id >= openHelper_Id && rs.Helper_Id <= closeHelper_Id && rs.SalesOrderDate >= salesOrderStartDate && rs.SalesOrderDate <= salesOrderEndDate && rs.SalesDate >= salesStartDate && rs.SalesDate <= salesEndDate) .ToList()); } else { readableSales = db.ReadableSales .Where(rs => rs.Customer_Id >= openCustomer_Id && rs.Customer_Id <= closeCustomer_Id && rs.Manufacturer_Id >= openManufacturer_Id && rs.Manufacturer_Id <= closeManufacturer_Id && rs.ResponsibleStaff_Id >= openStaff_Id && rs.ResponsibleStaff_Id <= closeStaff_Id && rs.Helper_Id >= openHelper_Id && rs.Helper_Id <= closeHelper_Id && rs.SalesOrderDate >= salesOrderStartDate && rs.SalesOrderDate <= salesOrderEndDate && rs.SalesDate >= salesStartDate && rs.SalesDate <= salesEndDate) .ToList(); return(readableSales); } } }
public static String toATML(CASS_MTPSI tpsi) { StringWriter tw = new StringWriter(); TestConfiguration testConfig = new TestConfiguration(); ManufacturerData configManager = testConfig.ConfigurationManager; List <CASS_MTPSICASS_MTPSI_page> pages = tpsi.CASS_MTPSI_page; foreach (CASS_MTPSICASS_MTPSI_page page in pages) { CASS_MTPSICASS_MTPSI_pageUUT uut = page.UUT; String partNo = uut.UUT_ID.Part_Number; //UUTInstance instance = new UUTInstance(); UUTDescription item = new UUTDescription(); //item.Item.name = uut.UUT_ID.Part_Number; //Lookup UUT Information ItemDescriptionReference reference = new ItemDescriptionReference(); DocumentReference docRef = new DocumentReference(); //docRef.ID = uut.UUT_ID.Part_Number; docRef.uuid = "{SOMEUUIDHERE}"; reference.Item = docRef;// item.Item; //testConfig.TestedUUTs.Add(reference); TestConfigurationTestEquipmentItem testEquipment = new TestConfigurationTestEquipmentItem(); foreach (CASS_MTPSICASS_MTPSI_pageATE_assets asset in page.ATE_assets) { ItemDescriptionReference refEquip = new ItemDescriptionReference(); ItemDescription instrument = new ItemDescription(); instrument.name = asset.Asset_Identifier; refEquip.Item = instrument; //testEquipment.Instrumentation.Add(refEquip); } // testConfig.TestEquipment.Add(testEquipment); try { XmlSerializer serializerObj = new XmlSerializer(typeof(TestConfiguration)); serializerObj.Serialize(tw, testConfig); } catch (Exception e) { Exception ie = e.InnerException; while (ie != null) { Trace.WriteLine(ie.Message); ie = ie.InnerException; } } break; } return(tw.ToString()); }
public List <BeforeDelivery> GetSpecificWordGroup(int customer_Id, int manufacturer_Id, string keywords, int responsibleStaff_Id, int helper_Id, DateTime startDate, DateTime endDate) { using (DefaultConnection db = new DefaultConnection()) { int openCustomer_Id = BusinessPartnerData.GetIdRange(db, customer_Id)[0]; int closeCustomer_Id = BusinessPartnerData.GetIdRange(db, customer_Id)[1]; int openManufacturer_Id = ManufacturerData.GetIdRange(db, manufacturer_Id)[0]; int closeManufacturer_Id = ManufacturerData.GetIdRange(db, manufacturer_Id)[1]; int openStaff_Id = IdRange.Staff(db, responsibleStaff_Id)[0]; int closeStaff_Id = IdRange.Staff(db, responsibleStaff_Id)[1]; int openHelper_Id = IdRange.Helper(db, helper_Id)[0]; int closeHelper_Id = IdRange.Helper(db, helper_Id)[1]; List <BeforeDelivery> beforeDeliveries = new List <BeforeDelivery>(); if (!String.IsNullOrEmpty(keywords)) { SQLWhereString whereString = new SQLWhereString(); string where = whereString.SearchKeyWhere <BeforeDelivery>(db, keywords); string[] keywordArray = keywords.Split(new[] { ' ', ' ' }); beforeDeliveries = db.Database .SqlQuery <BeforeDelivery>(where) .ToList(); return(beforeDeliveries .Where(so => so.Customer_Id >= openCustomer_Id && so.Customer_Id <= closeCustomer_Id && so.Manufacturer_Id >= openManufacturer_Id && so.Manufacturer_Id <= closeManufacturer_Id && so.ResponsibleStaff_Id >= openStaff_Id && so.ResponsibleStaff_Id <= closeStaff_Id && so.Helper_Id >= openHelper_Id && so.Helper_Id <= closeHelper_Id && so.SalesOrderDate >= startDate && so.SalesOrderDate <= endDate) .ToList()); } else { return(db.BeforeDeliveries .Where(so => so.Customer_Id >= openCustomer_Id && so.Customer_Id <= closeCustomer_Id && so.Manufacturer_Id >= openManufacturer_Id && so.Manufacturer_Id <= closeManufacturer_Id && so.ResponsibleStaff_Id >= openStaff_Id && so.ResponsibleStaff_Id <= closeStaff_Id && so.Helper_Id >= openHelper_Id && so.Helper_Id <= closeHelper_Id && so.SalesOrderDate >= startDate && so.SalesOrderDate <= endDate) .ToList()); } } }
public List <ReadablePurchase> GetSpecificWordGroup(string supplier, string manufacturer, string keywords, int staff_Id, DateTime purchaseStartDate, DateTime purchaseEndDate, DateTime receiptStartDate, DateTime receiptEndDate) { using (DefaultConnection db = new DefaultConnection()) { SQLWhereString whereString = new SQLWhereString(); string where = whereString.SearchKeyWhere <ReadablePurchase>(db, keywords); int[] supplier_Ids = BusinessPartnerData.NameToId(db, supplier); int openSupplier_Id = supplier_Ids[0]; int closeSupplier_Id = supplier_Ids[1]; int[] manufacturer_Ids = ManufacturerData.NameToId(db, manufacturer); int openManufacturer_Id = manufacturer_Ids[0]; int closeManufacturer_Id = manufacturer_Ids[1]; int[] staff_Ids = StaffData.GetIdRange(db, staff_Id); int openStaff_Id = staff_Ids[0]; int closeStaff_Id = staff_Ids[1]; List <ReadablePurchase> readablePurchases = new List <ReadablePurchase>(); if (!String.IsNullOrEmpty(keywords)) { readablePurchases = db.Database .SqlQuery <ReadablePurchase>(where) .ToList(); return(readablePurchases .Where(p => p.Supplier_Id >= openSupplier_Id && p.Supplier_Id <= closeSupplier_Id && p.ResponsibleStaff_Id >= openStaff_Id && p.ResponsibleStaff_Id <= closeStaff_Id && p.PurchaseDate >= purchaseStartDate && p.PurchaseDate <= purchaseEndDate && p.ReceiptDate >= receiptStartDate && p.ReceiptDate <= receiptEndDate) .ToList()); } else { readablePurchases = db.ReadablePurchases .Where(p => p.Supplier_Id >= openSupplier_Id && p.Supplier_Id <= closeSupplier_Id && p.ResponsibleStaff_Id >= openStaff_Id && p.ResponsibleStaff_Id <= closeStaff_Id && p.PurchaseDate >= purchaseStartDate && p.PurchaseDate <= purchaseEndDate && p.ReceiptDate >= receiptStartDate) .ToList(); return(readablePurchases); } } }
public List<ReadableGoodsIssue> GetSpecificWordGroup(string manufacturer, string keywords, int accountTitle_Id , int responsibleStaff_Id, DateTime startDate, DateTime endDate) { using (DefaultConnection db = new DefaultConnection()) { int[] manufacturer_Ids = ManufacturerData.NameToId(db, manufacturer); int openManufacturer_Id = manufacturer_Ids[0]; int closeManufacturer_Id = manufacturer_Ids[1]; int[] accountTitle_Ids = AccountTitleData.GetIdRange(db, accountTitle_Id); int openAccountTitle_Id = accountTitle_Ids[0]; int closeAccountTitle_Id = accountTitle_Ids[1]; int[] staff_Ids = StaffData.GetIdRange(db, responsibleStaff_Id); int openResponsibleStaff_Id = staff_Ids[0]; int closeResponsibleStaff_Id = staff_Ids[1]; if (!String.IsNullOrEmpty(keywords)) { SQLWhereString whereString = new SQLWhereString(); string where = whereString.SearchKeyWhere<ReadableGoodsIssue>(db, keywords); List<ReadableGoodsIssue> readableGoodsIssues = new List<ReadableGoodsIssue>(); readableGoodsIssues = db.Database .SqlQuery<ReadableGoodsIssue>(where) .ToList(); return readableGoodsIssues .Where(gi => gi.AccountTitle_Id >= openAccountTitle_Id && gi.AccountTitle_Id <= closeAccountTitle_Id && gi.FluctuatingDate >= startDate && gi.FluctuatingDate <= endDate && gi.Manufacturer_Id >= openManufacturer_Id && gi.Manufacturer_Id <= closeManufacturer_Id && gi.ResponsibleStaff_Id >= openResponsibleStaff_Id && gi.ResponsibleStaff_Id <= closeResponsibleStaff_Id) .ToList(); } else { return db.ReadableGoodsIssues .Where(r => r.AccountTitle_Id >= openAccountTitle_Id && r.AccountTitle_Id <= closeAccountTitle_Id && r.FluctuatingDate >= startDate && r.FluctuatingDate <= endDate && r.Manufacturer_Id >= openManufacturer_Id && r.Manufacturer_Id <= closeManufacturer_Id && r.ResponsibleStaff_Id >= openResponsibleStaff_Id && r.ResponsibleStaff_Id <= closeResponsibleStaff_Id) .ToList(); } } }
public ActionResult ManufacturerContent(string initial) { if (Request.IsAjaxRequest()) { ManufacturerData data = new ManufacturerData(); var results = data.GetSpecificInitialGroup(initial); if (results.Count() == 0) { return(PartialView("_NoResult")); } else { return(PartialView("_ManufacturerContent", results)); } } return(Content("Ajax通信以外のアクセスはできません")); }
/// <summary> /// Register this agent with the server. Receives new System UUID. /// </summary> /// <returns>True when we've received a new System UUID</returns> public static bool RegisterWithServer() { Log.Info("Registering with the server"); // Register yourself in order to get a System GUID RegistrationEventPost registration = new RegistrationEventPost(); registration.CustomerUUID = SRSvc.conf.GroupUUID; registration.AgentVersion = SRSvc.conf.Version; registration.OSHumanName = GetOSFriendlyName(); registration.OSVersion = Environment.OSVersion.ToString(); registration.Arch = (Environment.Is64BitOperatingSystem ? "64-bit" : "32-bit"); registration.MachineName = Environment.MachineName; ManufacturerData md = GetManufacturerData(); registration.Manufacturer = md.Manufacturer; registration.Model = md.Model; registration.MachineGUID = GetWindowsMachineGUID(); string postMessage = Helpers.SerializeToJson(registration, typeof(RegistrationEventPost)); string response = Beacon.PostToServer(postMessage, "/api/v1/Register"); if (response == "") { // Likely we were unable to contact the server return(false); } dynamic serverMsg = Json.Decode(response); if (serverMsg.Command == "SetSystemUUID") { Command.SetSystemUUID(serverMsg); } else { throw new Exception("Registration response command not in correct format"); } return(true); }
public List <BeforeWarehousing> GetSpecificWordGroup(int supplier_Id, int manufacturer_Id, string keywords, DateTime startDate, DateTime endDate) { using (DefaultConnection db = new DefaultConnection()) { int openSupplier_Id = BusinessPartnerData.GetIdRange(db, supplier_Id)[0]; int closeSupplier_Id = BusinessPartnerData.GetIdRange(db, supplier_Id)[1]; int openManufacturer_Id = ManufacturerData.GetIdRange(db, manufacturer_Id)[0]; int closeManufacturer_Id = ManufacturerData.GetIdRange(db, manufacturer_Id)[1]; List <BeforeWarehousing> beforeWarehousings = new List <BeforeWarehousing>(); if (!String.IsNullOrEmpty(keywords)) { SQLWhereString whereString = new SQLWhereString(); string where = whereString.SearchKeyWhere <BeforeWarehousing>(db, keywords); beforeWarehousings = db.Database .SqlQuery <BeforeWarehousing>(where) .ToList(); beforeWarehousings = beforeWarehousings .Where(bw => bw.Supplier_Id >= openSupplier_Id && bw.Supplier_Id <= closeSupplier_Id && bw.Manufacturer_Id >= openManufacturer_Id && bw.Manufacturer_Id <= closeManufacturer_Id && bw.PurchaseDate >= startDate && bw.PurchaseDate <= endDate) .ToList(); return(beforeWarehousings); } else { beforeWarehousings = db.BeforeWarehousings .Where(bw => bw.Supplier_Id >= openSupplier_Id && bw.Supplier_Id <= closeSupplier_Id && bw.Manufacturer_Id >= openManufacturer_Id && bw.Manufacturer_Id <= closeManufacturer_Id && bw.PurchaseDate >= startDate && bw.PurchaseDate <= endDate) .ToList(); return(beforeWarehousings); } } }
private void ControlsToData() { if (HasAnyManufacturerData) { if (_manufacturerData == null) { _manufacturerData = new ManufacturerData(); } _manufacturerData.name = edtManufacturerName.GetValue <string>(); _manufacturerData.FaxNumber = edtManufacturerFaxNumber.GetValue <string>(); _manufacturerData.cageCode = edtManufacturerCageCode.GetValue <string>(); _manufacturerData.URL = edtManufacturerURL.GetValue <string>(); _manufacturerData.MailingAddress = chkHasAddress.Checked ? mailingAddressControl.MailingAddress : null; _manufacturerData.Contacts = manufacturerContactListControl.Contacts; } else { _manufacturerData = null; } }
private static ManufacturerData GetManufacturerData() { ManufacturerData md = new ManufacturerData(); // create management class object ManagementClass mc = new ManagementClass("Win32_ComputerSystem"); //collection to store all management objects ManagementObjectCollection moc = mc.GetInstances(); if (moc.Count != 0) { foreach (ManagementObject mo in mc.GetInstances()) { // display general system information md.Manufacturer = mo["Manufacturer"].ToString(); md.Model = mo["Model"].ToString(); break; } } return(md); }
protected void AddManufacturerData(int manufacturerCode, object data) { ManufacturerData.Add(manufacturerCode.ToString(), data); }
public async Task CreateServer() { if (CrossBleAdapter.Current.Status == AdapterStatus.PoweredOn) { try { RaiseInfoEvent("Creating Gatt Server"); _server = await CrossBleAdapter.Current.CreateGattServer(); RaiseInfoEvent("Gatt Server Created"); _service = _server.CreateService(_primaryServiceUUID, true); RaiseInfoEvent("Primary Service Created"); _serverReadWriteCharacteristic = _service.AddCharacteristic ( _readWriteCharacteristicUUID, CharacteristicProperties.Read | CharacteristicProperties.Write | CharacteristicProperties.WriteNoResponse, GattPermissions.Read | GattPermissions.Write ); //_serverNotifyCharacteristic = _service.AddCharacteristic //( // _notifyServiceUUID, // CharacteristicProperties.Indicate | CharacteristicProperties.Notify, // GattPermissions.Read | GattPermissions.Write //); _serverReadWriteCharacteristic.WhenReadReceived().Subscribe(x => { _serverReadCount++; x.Value = Encoding.UTF8.GetBytes($"Server Response: {_serverReadCount}"); x.Status = GattStatus.Success; // you can optionally set a status, but it defaults to Success RaiseInfoEvent("Received Read Request"); }); _serverReadWriteCharacteristic.WhenWriteReceived().Subscribe(x => { var textReceivedFromClient = Encoding.UTF8.GetString(x.Value, 0, x.Value.Length); RaiseInfoEvent(textReceivedFromClient); }); RaiseInfoEvent("Characteristics Added"); var adData = new AdvertisementData { LocalName = _serverName, ServiceUuids = new List <Guid> { _primaryServiceUUID } }; var manufacturerData = new ManufacturerData { CompanyId = 1, Data = Encoding.UTF8.GetBytes("Tomorrow Never Dies") }; adData.ManufacturerData = manufacturerData; RaiseInfoEvent("Starting Ad Service"); CrossBleAdapter.Current.Advertiser.Start(adData); RaiseInfoEvent("Server and Service Started"); RaiseServerClientStarted(true); } catch (Exception e) { RaiseErrorEvent(e); } } else { var exception = new Exception("Bluetooth is OFF"); RaiseErrorEvent(exception); } }
public ActionResult ManufacturerName(string term) { ManufacturerData data = new ManufacturerData(); return(Json(data.GetNames(term), JsonRequestBehavior.AllowGet)); }