Initial project commit

This commit is contained in:
2020-07-18 21:44:27 -04:00
parent 8a1141b373
commit fea891a268
127 changed files with 20838 additions and 0 deletions

View File

@@ -0,0 +1,62 @@
package com.eveningoutpost.dexdrip.Models;
import android.provider.BaseColumns;
import com.activeandroid.Model;
import com.activeandroid.annotation.Column;
import com.activeandroid.annotation.Table;
import com.activeandroid.query.Select;
/**
* Created by Emma Black on 11/3/14.
*/
@Table(name = "ActiveBluetoothDevice", id = BaseColumns._ID)
public class ActiveBluetoothDevice extends Model {
@Column(name = "name")
public String name;
@Column(name = "address")
public String address;
@Column(name = "connected")
public boolean connected;
public static final Object table_lock = new Object();
public static synchronized ActiveBluetoothDevice first() {
return new Select()
.from(ActiveBluetoothDevice.class)
.orderBy("_ID asc")
.executeSingle();
}
public static synchronized void forget() {
ActiveBluetoothDevice activeBluetoothDevice = ActiveBluetoothDevice.first();
if (activeBluetoothDevice != null) {
activeBluetoothDevice.delete();
}
}
public static synchronized void connected() {
ActiveBluetoothDevice activeBluetoothDevice = ActiveBluetoothDevice.first();
if(activeBluetoothDevice != null) {
activeBluetoothDevice.connected = true;
activeBluetoothDevice.save();
}
}
public static synchronized void disconnected() {
ActiveBluetoothDevice activeBluetoothDevice = ActiveBluetoothDevice.first();
if(activeBluetoothDevice != null) {
activeBluetoothDevice.connected = false;
activeBluetoothDevice.save();
}
}
public static synchronized boolean is_connected() {
ActiveBluetoothDevice activeBluetoothDevice = ActiveBluetoothDevice.first();
return (activeBluetoothDevice != null && activeBluetoothDevice.connected);
}
}