void blueToothListView_ItemClick(object sender, AdapterView.ItemClickEventArgs e)
        {
            BtDevices device = adapter.GetBlueToothListItem(e.Position);

            device.MacAddress = "";

            adapter.NotifyDataSetChanged();
        }
예제 #2
0
        public int AddUpdateBtDevice(BtDevice btdevice, GPSLocation gpsLocation)
        {
            int btDeviceId = 0;

            iBeacon_Indexer.BtDevices btDevicesIndividual = new BtDevices();

            btDevicesIndividual.Name       = btdevice.Name;
            btDevicesIndividual.Type       = btdevice.Type;
            btDevicesIndividual.MacAddress = btdevice.MacAddress;
            btDevicesIndividual.Strength   = btdevice.Strength;
            btDevicesIndividual.UUID       = btdevice.UuidString;
            btDevicesIndividual.Major      = btdevice.MajorInt;
            btDevicesIndividual.Minor      = btdevice.MinorInt;
            btDevicesIndividual.TimeFound  = btdevice.TimeFound.ToString();

            BtDevices deviceAlreadyExists = GetBtDevice(btdevice.UuidString, btdevice.MajorInt, btdevice.MinorInt);

            if (deviceAlreadyExists == null)
            {
                btDeviceId = conn.Insert(btDevicesIndividual);
                gpsLocation.BtDevicesId = btDeviceId;
                conn.Insert(gpsLocation);
            }
            else
            {
                btDevicesIndividual.Id = deviceAlreadyExists.Id;
                conn.Update(btDevicesIndividual);

                GPSLocation existingGPSLocation = GetGpsLocation(btDevicesIndividual.Id);
                if (existingGPSLocation == null)
                {
                    existingGPSLocation                   = new GPSLocation();
                    existingGPSLocation.BtDevicesId       = btDeviceId;
                    existingGPSLocation.Address           = gpsLocation.Address;
                    existingGPSLocation.Altitude          = gpsLocation.Altitude;
                    existingGPSLocation.LatitudeLongitude = gpsLocation.LatitudeLongitude;
                    conn.Insert(gpsLocation);
                }
                else
                {
                    existingGPSLocation.BtDevicesId       = btDeviceId;
                    existingGPSLocation.Address           = gpsLocation.Address;
                    existingGPSLocation.Altitude          = gpsLocation.Altitude;
                    existingGPSLocation.LatitudeLongitude = gpsLocation.LatitudeLongitude;
                    conn.Update(existingGPSLocation);
                }
            }

            return(btDeviceId);
        }
예제 #3
0
        public int AddNewBtDevice(BtDevice btdevice, GPSLocation newGpsLocation)
        {
            iBeacon_Indexer.BtDevices btDevicesIndividual = new BtDevices();
            btDevicesIndividual.Name       = btdevice.Name;
            btDevicesIndividual.Type       = btdevice.Type;
            btDevicesIndividual.MacAddress = btdevice.MacAddress;
            btDevicesIndividual.Strength   = btdevice.Strength;
            btDevicesIndividual.UUID       = btdevice.UuidString;
            btDevicesIndividual.Major      = btdevice.MajorInt;
            btDevicesIndividual.Minor      = btdevice.MinorInt;

            int newBTDeviceId = conn.Insert(btDevicesIndividual);;

            newGpsLocation.BtDevicesId = newBTDeviceId;
            conn.Insert(newGpsLocation);

            return(newBTDeviceId);
        }
예제 #4
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            var view             = convertView ?? _activity.LayoutInflater.Inflate(Resource.Layout.BlueToothListItemView, parent, false);
            var deviceName       = view.FindViewById <TextView>(Resource.Id.btListItemName);
            var deviceType       = view.FindViewById <TextView>(Resource.Id.btListItemType);
            var deviceStrength   = view.FindViewById <TextView>(Resource.Id.btListItemStength);
            var deviceMacAddress = view.FindViewById <TextView>(Resource.Id.btListItemMacAddress);
            var deviceRawData    = view.FindViewById <TextView>(Resource.Id.btListItemRaw);

            deviceName.Text       = btDeviceList[position].Name;
            deviceType.Text       = "";
            deviceStrength.Text   = "";
            deviceMacAddress.Text = "";
            BtDevices deviceInQuestion = btDeviceList [position];

            var dump = ObjectDumper.Dump(deviceInQuestion);

            deviceRawData.Text = dump;


            return(view);
        }
예제 #5
0
 public void Add(BtDevices item)
 {
     btDeviceList.Add(item);
 }