本文整理汇总了Java中com.eveningoutpost.dexdrip.Services.G5CollectionService类的典型用法代码示例。如果您正苦于以下问题:Java G5CollectionService类的具体用法?Java G5CollectionService怎么用?Java G5CollectionService使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
G5CollectionService类属于com.eveningoutpost.dexdrip.Services包,在下文中一共展示了G5CollectionService类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: syncFieldData
import com.eveningoutpost.dexdrip.Services.G5CollectionService; //导入依赖的package包/类
private void syncFieldData(DataMap dataMap) {
String dex_txid = dataMap.getString("dex_txid", "");
byte[] G5_BATTERY_MARKER = dataMap.getByteArray(G5CollectionService.G5_BATTERY_MARKER);
byte[] G5_FIRMWARE_MARKER = dataMap.getByteArray(G5CollectionService.G5_FIRMWARE_MARKER);
if (dex_txid != null && dex_txid.equals(mPrefs.getString("dex_txid", "default"))) {
if (G5_BATTERY_MARKER != null) {
long watch_last_battery_query = dataMap.getLong(G5CollectionService.G5_BATTERY_FROM_MARKER);
long phone_last_battery_query = PersistentStore.getLong(G5CollectionService.G5_BATTERY_FROM_MARKER + dex_txid);
if (watch_last_battery_query > phone_last_battery_query) {
G5CollectionService.setStoredBatteryBytes(dex_txid, G5_BATTERY_MARKER);
PersistentStore.setLong(G5CollectionService.G5_BATTERY_FROM_MARKER + dex_txid, watch_last_battery_query);
G5CollectionService.getBatteryStatusNow = false;
Ob1G5CollectionService.getBatteryStatusNow = false;
}
}
if (G5_FIRMWARE_MARKER != null) {
G5CollectionService.setStoredFirmwareBytes(dex_txid, G5_FIRMWARE_MARKER);
}
}
}
示例2: addListenerOnButton
import com.eveningoutpost.dexdrip.Services.G5CollectionService; //导入依赖的package包/类
public void addListenerOnButton() {
button = (Button)findViewById(R.id.stop_sensor);
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Sensor.stopSensor();
AlertPlayer.getPlayer().stopAlert(getApplicationContext(), true, false);
Toast.makeText(getApplicationContext(), "Sensor stopped", Toast.LENGTH_LONG).show();
//If Sensor is stopped for G5, we need to prevent further BLE scanning.
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
String collection_method = prefs.getString("dex_collection_method", "BluetoothWixel");
if(collection_method.compareTo("DexcomG5") == 0) {
Intent serviceIntent = new Intent(getApplicationContext(), G5CollectionService.class);
startService(serviceIntent);
}
Intent intent = new Intent(getApplicationContext(), Home.class);
startActivity(intent);
finish();
}
});
}
示例3: startBtG5Service
import com.eveningoutpost.dexdrip.Services.G5CollectionService; //导入依赖的package包/类
public void startBtG5Service() {//private
Log.d(TAG, "starting G5 service");
//if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR2) {
PersistentStore.setBoolean(pref_run_wear_collector, true);
if (!Pref.getBooleanDefaultFalse(Ob1G5CollectionService.OB1G5_PREFS)) {
G5CollectionService.keep_running = true;
this.mContext.startService(new Intent(this.mContext, G5CollectionService.class));
} else {
Ob1G5CollectionService.keep_running = true;
this.mContext.startService(new Intent(this.mContext, Ob1G5CollectionService.class));
}
//}
}
示例4: stopG5ShareService
import com.eveningoutpost.dexdrip.Services.G5CollectionService; //导入依赖的package包/类
private void stopG5ShareService() {
Log.d(TAG, "stopping G5 service");
G5CollectionService.keep_running = false; // ensure zombie stays down
this.mContext.stopService(new Intent(this.mContext, G5CollectionService.class));
Ob1G5CollectionService.keep_running = false; // ensure zombie stays down
this.mContext.stopService(new Intent(this.mContext, Ob1G5CollectionService.class));
}
示例5: addListenerOnButton
import com.eveningoutpost.dexdrip.Services.G5CollectionService; //导入依赖的package包/类
public void addListenerOnButton() {
button = (Button)findViewById(R.id.stop_sensor);
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Sensor.stopSensor();
AlertPlayer.getPlayer().stopAlert(getApplicationContext(), true, false);
Toast.makeText(getApplicationContext(), "Sensor stopped", Toast.LENGTH_LONG).show();
JoH.clearCache();
LibreAlarmReceiver.clearSensorStats();
PluggableCalibration.invalidateAllCaches();
//If Sensor is stopped for G5, we need to prevent further BLE scanning.
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
String collection_method = prefs.getString("dex_collection_method", "BluetoothWixel");
if(collection_method.compareTo("DexcomG5") == 0) {
Intent serviceIntent = new Intent(getApplicationContext(), G5CollectionService.class);
startService(serviceIntent);
}
final Intent intent = new Intent(getApplicationContext(), Home.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Home.startIntentThreadWithDelayedRefresh(intent);
finish();
}
});
}
示例6: startBtG5Service
import com.eveningoutpost.dexdrip.Services.G5CollectionService; //导入依赖的package包/类
private void startBtG5Service() {
Log.d(TAG,"stopping G5 service");
stopG5ShareService();
Log.d(TAG, "starting G5 service");
//if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR2) {
if (!Pref.getBooleanDefaultFalse(Ob1G5CollectionService.OB1G5_PREFS)) {
G5CollectionService.keep_running = true;
this.mContext.startService(new Intent(this.mContext, G5CollectionService.class));
} else {
Ob1G5CollectionService.keep_running = true;
this.mContext.startService(new Intent(this.mContext, Ob1G5CollectionService.class));
}
//}
}
示例7: stopG5ShareService
import com.eveningoutpost.dexdrip.Services.G5CollectionService; //导入依赖的package包/类
private void stopG5ShareService() {
Log.d(TAG, "stopping G5 service");
G5CollectionService.keep_running = false; // ensure zombie stays down
this.mContext.stopService(new Intent(this.mContext, G5CollectionService.class));
Ob1G5CollectionService.keep_running = false; // ensure zombie stays down
this.mContext.stopService(new Intent(this.mContext, Ob1G5CollectionService.class));
}
示例8: populate
import com.eveningoutpost.dexdrip.Services.G5CollectionService; //导入依赖的package包/类
private static void populate(MegaStatusListAdapter la, String section) {
if ((la == null) || (section == null)) {
UserError.Log.e(TAG, "Adapter or Section were null in populate()");
return;
}
la.clear(false);
switch (section) {
case G4_STATUS:
la.addRows(DexCollectionService.megaStatus());
break;
case G5_STATUS:
if (Pref.getBooleanDefaultFalse(Ob1G5CollectionService.OB1G5_PREFS)) {
la.addRows(Ob1G5CollectionService.megaStatus());
} else {
la.addRows(G5CollectionService.megaStatus());
}
break;
case IP_COLLECTOR:
la.addRows(WifiCollectionService.megaStatus(mActivity));
break;
case XDRIP_PLUS_SYNC:
la.addRows(DoNothingService.megaStatus());
la.addRows(GcmListenerSvc.megaStatus());
la.addRows(RollCall.megaStatus());
break;
case UPLOADERS:
la.addRows(UploaderQueue.megaStatus());
break;
}
la.changed();
}
示例9: requestWearCollectorStatus
import com.eveningoutpost.dexdrip.Services.G5CollectionService; //导入依赖的package包/类
private void requestWearCollectorStatus() {
if (Home.get_enable_wear()) {
if (DexCollectionType.getDexCollectionType().equals(DexcomG5)) {
startWatchUpdaterService(xdrip.getAppContext(), WatchUpdaterService.ACTION_STATUS_COLLECTOR, TAG, "getBatteryStatusNow", G5CollectionService.getBatteryStatusNow);
}
else {
startWatchUpdaterService(xdrip.getAppContext(), WatchUpdaterService.ACTION_STATUS_COLLECTOR, TAG);
}
}
}
示例10: requestWearCollectorStatus
import com.eveningoutpost.dexdrip.Services.G5CollectionService; //导入依赖的package包/类
private void requestWearCollectorStatus() {
final PowerManager.WakeLock wl = JoH.getWakeLock("ACTION_STATUS_COLLECTOR",120000);
if (Home.get_enable_wear()) {
if (DexCollectionType.getDexCollectionType().equals(DexcomG5)) {
startWatchUpdaterService(safeGetContext(), WatchUpdaterService.ACTION_STATUS_COLLECTOR, TAG, "getBatteryStatusNow", G5CollectionService.getBatteryStatusNow);
}
else {
startWatchUpdaterService(safeGetContext(), WatchUpdaterService.ACTION_STATUS_COLLECTOR, TAG);
}
}
JoH.releaseWakeLock(wl);
}
示例11: startBtG5Service
import com.eveningoutpost.dexdrip.Services.G5CollectionService; //导入依赖的package包/类
private void startBtG5Service() {//KS
Log.d(TAG, "startBtG5Service");
//is_using_g5 = (getDexCollectionType() == DexCollectionType.DexcomG5);
is_using_bt = DexCollectionType.hasBluetooth();
if (is_using_bt) {
Context myContext = getApplicationContext();
Log.d(TAG, "startBtG5Service start G5CollectionService");
myContext.startService(new Intent(myContext, G5CollectionService.class));
Log.d(TAG, "startBtG5Service AFTER startService G5CollectionService");
} else {
Log.d(TAG, "Not starting any G5 service as it is not our data source");
}
}
示例12: sendCollectorStatus
import com.eveningoutpost.dexdrip.Services.G5CollectionService; //导入依赖的package包/类
private void sendCollectorStatus (Context context, String path) {
String msg;
//long last_timestamp = 0;
DataMap dataMap = new DataMap();
switch (DexCollectionType.getDexCollectionType()) {
case DexcomG5:
if (DexCollectionType.getCollectorServiceClass() == G5CollectionService.class) {
dataMap = G5CollectionService.getWatchStatus();//msg, last_timestamp
} else {
dataMap = Ob1G5CollectionService.getWatchStatus();//msg, last_timestamp
}
break;
case DexcomShare://TODO getLastState() in non-G5 Services
BluetoothManager mBluetoothManager = (BluetoothManager) context.getSystemService(Context.BLUETOOTH_SERVICE);
ActiveBluetoothDevice activeBluetoothDevice = ActiveBluetoothDevice.first();
boolean connected = false;
if (mBluetoothManager != null && activeBluetoothDevice != null) {
for (BluetoothDevice bluetoothDevice : mBluetoothManager.getConnectedDevices(BluetoothProfile.GATT)) {
if (bluetoothDevice.getAddress().compareTo(activeBluetoothDevice.address) == 0) {
connected = true;
}
}
}
if (connected) {
msg = "Connected on watch";
} else {
msg = "Not Connected";
}
dataMap.putString("lastState", msg);
break;
default:
dataMap = DexCollectionService.getWatchStatus();
break;
}
if (dataMap != null) {
dataMap.putString("action_path", path);
}
//sendReplyMsg (msg, last_timestamp, path, false);
sendData(WEARABLE_REPLYMSG_PATH, dataMap.toByteArray());
}
示例13: onCreate
import com.eveningoutpost.dexdrip.Services.G5CollectionService; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mActivity = this;
setContentView(R.layout.activity_mega_status);
JoH.fixActionBar(this);
sectionList.clear();
sectionTitles.clear();
populateSectionList();
mSectionsPagerAdapter = new SectionsPagerAdapter(getFragmentManager());
mViewPager = (ViewPager) findViewById(R.id.container);
mViewPager.setAdapter(mSectionsPagerAdapter);
// switch to last used position if it exists
int saved_position = (int) PersistentStore.getLong("mega-status-last-page");
// if triggered from pending intent, flip to named section if we can
final String action = getIntent().getAction();
if ((action != null) && (action.length() > 0)) {
int action_position = sectionList.indexOf(action);
if (action_position > -1) saved_position = action_position;
}
if ((saved_position > 0) && (saved_position < sectionList.size())) {
currentPage = saved_position;
mViewPager.setCurrentItem(saved_position);
autoStart = true; // run once activity becomes visible
}
mViewPager.addOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
@Override
public void onPageSelected(int position) {
UserError.Log.d(TAG, "Page selected: " + position);
runnableView = null;
currentPage = position;
startAutoFresh();
PersistentStore.setLong("mega-status-last-page", currentPage);
}
});
// streamed data from android wear
requestWearCollectorStatus();
serviceDataReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context ctx, Intent intent) {
final String action = intent.getAction();
//final String msg = intent.getStringExtra("data");
Bundle bundle = intent.getBundleExtra("data");
if (bundle != null) {
DataMap dataMap = DataMap.fromBundle(bundle);
String lastState = dataMap.getString("lastState", "");
long last_timestamp = dataMap.getLong("timestamp", 0);
UserError.Log.d(TAG, "serviceDataReceiver onReceive:" + action + " :: " + lastState + " last_timestamp :: " + last_timestamp);
switch (action) {
case WatchUpdaterService.ACTION_BLUETOOTH_COLLECTION_SERVICE_UPDATE:
switch (DexCollectionType.getDexCollectionType()) {
case DexcomG5:
// as this is fairly lightweight just write the data to both G5 collectors
G5CollectionService.setWatchStatus(dataMap);//msg, last_timestamp
Ob1G5CollectionService.setWatchStatus(dataMap);//msg, last_timestamp
break;
case DexcomShare:
if (lastState != null && !lastState.isEmpty()) {
//setConnectionStatus(lastState);//TODO set System Status page connection_status.setText to lastState for non-G5 Services?
}
break;
default:
DexCollectionService.setWatchStatus(dataMap);//msg, last_timestamp
if (lastState != null && !lastState.isEmpty()) {
//setConnectionStatus(lastState);//TODO set System Status page connection_status.setText to lastState for non-G5 Services?
}
break;
}
break;
}
}
}
};
}
示例14: setConnectionStatus
import com.eveningoutpost.dexdrip.Services.G5CollectionService; //导入依赖的package包/类
private void setConnectionStatus() {
boolean connected = false;
if (mBluetoothManager != null && activeBluetoothDevice != null) {
for (BluetoothDevice bluetoothDevice : mBluetoothManager.getConnectedDevices(BluetoothProfile.GATT)) {
if (bluetoothDevice.getAddress().compareTo(activeBluetoothDevice.address) == 0) {
connected = true;
}
}
}
if(connected) {
connection_status.setText("Connected");
} else {
connection_status.setText("Not Connected");
}
String collection_method = prefs.getString("dex_collection_method", "BluetoothWixel");
if(collection_method.compareTo("DexcomG5") == 0) {
Transmitter defaultTransmitter = new Transmitter(prefs.getString("dex_txid", "ABCDEF"));
mBluetoothAdapter = mBluetoothManager.getAdapter();
if (mBluetoothAdapter != null) {
Set<BluetoothDevice> pairedDevices = mBluetoothAdapter.getBondedDevices();
if (pairedDevices.size() > 0) {
for (BluetoothDevice device : pairedDevices) {
if (device.getName() != null) {
String transmitterIdLastTwo = Extensions.lastTwoCharactersOfString(defaultTransmitter.transmitterId);
String deviceNameLastTwo = Extensions.lastTwoCharactersOfString(device.getName());
if (transmitterIdLastTwo.equals(deviceNameLastTwo)) {
final String fw = G5CollectionService.getFirmwareVersionString(defaultTransmitter.transmitterId);
connection_status.setText(device.getName() + " Authed" + ((fw != null) ? ("\n" + fw) : ""));
break;
}
}
}
}
} else {
connection_status.setText("No bluetooth");
}
}
}
示例15: onCreateView
import com.eveningoutpost.dexdrip.Services.G5CollectionService; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
//Injectors.getMicroStatusComponent().inject(this);
requestWearCollectorStatus();
serviceDataReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context ctx, Intent intent) {
final String action = intent.getAction();
//final String msg = intent.getStringExtra("data");
Bundle bundle = intent.getBundleExtra("data");
if (bundle != null) {
DataMap dataMap = DataMap.fromBundle(bundle);
String lastState = dataMap.getString("lastState", "");
long last_timestamp = dataMap.getLong("timestamp", 0);
UserError.Log.d(TAG, "serviceDataReceiver onReceive:" + action + " :: " + lastState + " last_timestamp :: " + last_timestamp);
switch (action) {
case WatchUpdaterService.ACTION_BLUETOOTH_COLLECTION_SERVICE_UPDATE:
switch (DexCollectionType.getDexCollectionType()) {
case DexcomG5:
G5CollectionService.setWatchStatus(dataMap);//msg, last_timestamp
break;
case DexcomShare:
if (lastState != null && !lastState.isEmpty()) {
setConnectionStatus(lastState);//TODO getLastState() in non-G5 Services
}
break;
default:
DexCollectionService.setWatchStatus(dataMap);//msg, last_timestamp
if (lastState != null && !lastState.isEmpty()) {
setConnectionStatus(lastState);
}
break;
}
break;
}
}
}
};
final ActivitySystemStatusBinding binding = DataBindingUtil.inflate(
inflater, R.layout.activity_system_status, container, false);
microStatus = new MicroStatusImpl();
binding.setMs(microStatus);
return binding.getRoot();
}