Commit 6bf700e7 by Jeong Gilmo

#32917 芯温センサー

- 修正された詳細設計書について修正
parent bbfc0958
...@@ -1378,10 +1378,12 @@ ...@@ -1378,10 +1378,12 @@
<string name="thermometer">芯温計</string> <string name="thermometer">芯温計</string>
<string name="ble_is_not_supported">BLEを支援しません。</string> <string name="ble_is_not_supported">BLEを支援しません。</string>
<string name="bluetooth_is_not_supported">ブルートゥースを支援しません。</string> <string name="bluetooth_is_not_supported">ブルートゥースを支援しません。</string>
<string name="bluetooth_is_not_working">ブルートゥースが機能しません</string> <string name="bluetooth_is_not_working">ブルートゥース機能がオンになっているか確認してください</string>
<string name="msg_connected_bluetooth">%sに接続されました。</string> <string name="msg_connected_bluetooth">%sに接続されました。</string>
<string name="msg_ble_not_connect">接続が停止しました。</string> <string name="msg_ble_not_connect">接続が停止しました。</string>
<string name="msg_ble_connect_error">%sと接続されていません。\n%sと接続状態を設定画面の機器連携から確認してください。</string> <string name="msg_ble_connect_error">%sと接続されていません。\n%sと接続状態を設定画面の機器連携から確認してください。</string>
<string name="msg_permission_dialog_bluetooth">ブルートゥース利用権限が必要です。\nアプリ設定画面へ遷移します。</string> <string name="msg_permission_dialog_bluetooth">ブルートゥース利用権限が必要です。\nアプリ設定画面へ遷移します。</string>
<string name="msg_device_search">ディバイスを検索中</string>
<string name="msg_device_connecting">ディバイスと接続中</string>
<string name="msg_no_device_info">登録された機器情報がありません。\n設定画面の機器連携から確認してください。</string>
</resources> </resources>
...@@ -1384,5 +1384,7 @@ ...@@ -1384,5 +1384,7 @@
<string name="msg_ble_not_connect">접속이 정지되었습니다.</string> <string name="msg_ble_not_connect">접속이 정지되었습니다.</string>
<string name="msg_ble_connect_error">%s랑 접속되지않습니다.\n%s와의 접속상태를 설정화면의 기기연결에서 확인해주세요.</string> <string name="msg_ble_connect_error">%s랑 접속되지않습니다.\n%s와의 접속상태를 설정화면의 기기연결에서 확인해주세요.</string>
<string name="msg_permission_dialog_bluetooth">블루투스이용권한이 필요합니다.\n설정화면으로 이동합니다.</string> <string name="msg_permission_dialog_bluetooth">블루투스이용권한이 필요합니다.\n설정화면으로 이동합니다.</string>
<string name="msg_device_search">기기를 검색중\</string>
<string name="msg_device_connecting">기기와 접속중</string>
<string name="msg_no_device_info">등록된 기기정보가 없습니다.\n설정화면의 기기연결에서 확인해주세요.</string>
</resources> </resources>
\ No newline at end of file
...@@ -1383,5 +1383,7 @@ ...@@ -1383,5 +1383,7 @@
<string name="msg_ble_not_connect">The connection has stopped.</string> <string name="msg_ble_not_connect">The connection has stopped.</string>
<string name="msg_ble_connect_error">Not connected with% %s. \nCheck %s and connection status from the device linkage on the setting screen.</string> <string name="msg_ble_connect_error">Not connected with% %s. \nCheck %s and connection status from the device linkage on the setting screen.</string>
<string name="msg_permission_dialog_bluetooth">You need Bluetooth access authority. \nIt changes to the application setting.</string> <string name="msg_permission_dialog_bluetooth">You need Bluetooth access authority. \nIt changes to the application setting.</string>
<string name="msg_device_search">Searching Device</string>
<string name="msg_device_connecting">Connecting Device</string>
<string name="msg_no_device_info">There is no registered device information. \nPlease confirm from the device cooperation of the setting screen.</string>
</resources> </resources>
\ No newline at end of file
...@@ -21,15 +21,14 @@ ...@@ -21,15 +21,14 @@
android:layout_height="50dp"> android:layout_height="50dp">
<TextView <TextView
android:id="@+id/tv_toolbar_title" android:id="@+id/device_toolbar_title"
style="@style/DialogToolBarTitle" style="@style/DialogToolBarTitle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:text="@string/set_pairing"
android:textColor="@color/edt_text" android:textColor="@color/edt_text"
android:textSize="@dimen/opeartion_title_text_size" /> android:textSize="20sp" />
<ImageButton <ImageButton
android:id="@+id/close_btn" android:id="@+id/close_btn"
...@@ -40,32 +39,6 @@ ...@@ -40,32 +39,6 @@
android:background="@drawable/ic_operation_close" android:background="@drawable/ic_operation_close"
android:onClick="onClickCloseView" /> android:onClick="onClickCloseView" />
</RelativeLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_marginBottom="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_weight="1"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/toolbar2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="50dp"
android:visibility="visible">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:gravity="left"
android:text="@string/thermometer"
android:textSize="20sp" />
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
...@@ -74,26 +47,26 @@ ...@@ -74,26 +47,26 @@
android:layout_centerVertical="true"> android:layout_centerVertical="true">
<Button <Button
android:id="@+id/scan_button" android:id="@+id/btn_reload"
android:layout_width="50dp" android:layout_width="30dp"
android:layout_height="50dp" android:layout_height="30dp"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginRight="5dp"
android:text="@string/scan" />
<Button
android:id="@+id/stop_button"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_marginRight="5dp" android:layout_marginRight="5dp"
android:text="@string/stop" /> android:background="@drawable/ic_reload_list" />
</LinearLayout> </LinearLayout>
</RelativeLayout> </RelativeLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_marginBottom="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_weight="1"
android:orientation="vertical">
<View <View
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="2dp" android:layout_height="2dp"
......
...@@ -18,6 +18,8 @@ import android.bluetooth.BluetoothGattService; ...@@ -18,6 +18,8 @@ import android.bluetooth.BluetoothGattService;
import android.bluetooth.BluetoothManager; import android.bluetooth.BluetoothManager;
import android.bluetooth.BluetoothProfile; import android.bluetooth.BluetoothProfile;
import android.content.Context; import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import android.widget.Toast; import android.widget.Toast;
import static org.chromium.base.ThreadUtils.runOnUiThread; import static org.chromium.base.ThreadUtils.runOnUiThread;
...@@ -53,6 +55,7 @@ public class BleManagerUtil { ...@@ -53,6 +55,7 @@ public class BleManagerUtil {
// 接続状態変更(connectGatt()の結果として呼ばれる。) // 接続状態変更(connectGatt()の結果として呼ばれる。)
@Override @Override
public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState ) { public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState ) {
super.onConnectionStateChange(gatt, status, newState);
// if( BluetoothGatt.GATT_SUCCESS != status ) { // if( BluetoothGatt.GATT_SUCCESS != status ) {
// runOnUiThread( new Runnable() { // runOnUiThread( new Runnable() {
// public void run() { // public void run() {
...@@ -61,6 +64,17 @@ public class BleManagerUtil { ...@@ -61,6 +64,17 @@ public class BleManagerUtil {
// }); // });
// return; // return;
// } // }
Logger.d("GATT_ message : [ " + status);
// ディバイスと接続されていない場合のメッセージコード:133, 62
// ディバイスと接続が切れた場合のメッセージコード:19
if (status == 133 || status == 62) { // 接続失敗
runOnUiThread( new Runnable() {
public void run() {
listener.onConnectionError();
}
});
return;
}
if( status == BluetoothGatt.GATT_SUCCESS && BluetoothProfile.STATE_CONNECTED == newState ) { if( status == BluetoothGatt.GATT_SUCCESS && BluetoothProfile.STATE_CONNECTED == newState ) {
// 接続完了 // 接続完了
...@@ -91,7 +105,6 @@ public class BleManagerUtil { ...@@ -91,7 +105,6 @@ public class BleManagerUtil {
} ); } );
return; return;
} }
super.onConnectionStateChange(gatt, status, newState);
} }
// サービス検索が完了したときの処理(mBluetoothGatt.discoverServices()の結果として呼ばれる。) // サービス検索が完了したときの処理(mBluetoothGatt.discoverServices()の結果として呼ばれる。)
...@@ -195,6 +208,7 @@ public class BleManagerUtil { ...@@ -195,6 +208,7 @@ public class BleManagerUtil {
void onGetDeviceInfoFailed(); // ディバイスと接続失敗時の情報渡す。 void onGetDeviceInfoFailed(); // ディバイスと接続失敗時の情報渡す。
void onConnectionState(); // ディバイスと接続された時情報渡す。 void onConnectionState(); // ディバイスと接続された時情報渡す。
void onDisConnectionState(); // ディバイスと切断時 void onDisConnectionState(); // ディバイスと切断時
void onConnectionError(); // ディバイス接続エラー
} }
// 接続 // 接続
...@@ -273,20 +287,10 @@ public class BleManagerUtil { ...@@ -273,20 +287,10 @@ public class BleManagerUtil {
// Bluetoothアダプタの取得処理 // Bluetoothアダプタの取得処理
public void startDeviceInfo() { public void startDeviceInfo() {
// disconnect();
// bluetoothManager = (BluetoothManager) context.getSystemService(Context.BLUETOOTH_SERVICE);
// // Android端末がBLEをサポートしてるかの確認
// if( !context.getPackageManager().hasSystemFeature( PackageManager.FEATURE_BLUETOOTH_LE ) ) {
// Toast.makeText( context, R.string.ble_is_not_supported, Toast.LENGTH_SHORT ).show();
// return;
// }
// Bluetoothアダプタの取得 // Bluetoothアダプタの取得
BluetoothManager bluetoothManager = (BluetoothManager) context.getSystemService( Context.BLUETOOTH_SERVICE ); BluetoothManager bluetoothManager = (BluetoothManager) context.getSystemService( Context.BLUETOOTH_SERVICE );
mBluetoothAdapter = bluetoothManager.getAdapter(); mBluetoothAdapter = bluetoothManager.getAdapter();
if( null == mBluetoothAdapter ) if( null == mBluetoothAdapter ) { // Android端末がBluetoothをサポートしていない
{ // Android端末がBluetoothをサポートしていない
Toast.makeText( context, R.string.bluetooth_is_not_supported, Toast.LENGTH_SHORT ).show(); Toast.makeText( context, R.string.bluetooth_is_not_supported, Toast.LENGTH_SHORT ).show();
return; return;
} }
......
...@@ -239,7 +239,23 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity { ...@@ -239,7 +239,23 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
// get Device info // get Device info
bleManagerUtil = new BleManagerUtil(this, new BleManagerUtil.BleManagerUtilListener() { bleManagerUtil = new BleManagerUtil(this, new BleManagerUtil.BleManagerUtilListener() {
@Override @Override
public void onConnectionError() {
Logger.d(TAG, "onDisConnectionState");
putUserPref(UserPrefKey.BLUETOOTH_DEVICE_TEMPERATURE_CONNECTED, 0);
ABookAlertDialog alert = AlertDialogUtil.createAlertDialog(ABVContentViewActivity.this, R.string.thermometer);
alert.setMessage(String.format(getString(R.string.msg_ble_connect_error), getString(R.string.thermometer), getString(R.string.thermometer)));
alert.setButton(DialogInterface.BUTTON_POSITIVE, getString(R.string.ok), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
setThermometerData("");
}
});
alert.show();
}
@Override
public void onConnectionState() { // 接続 public void onConnectionState() { // 接続
Logger.d(TAG, "onDisConnectionState");
putUserPref(UserPrefKey.BLUETOOTH_DEVICE_TEMPERATURE_CONNECTED, 1); putUserPref(UserPrefKey.BLUETOOTH_DEVICE_TEMPERATURE_CONNECTED, 1);
ABVToastUtil.showMakeText(getApplicationContext(), ABVToastUtil.showMakeText(getApplicationContext(),
String.format(getString(R.string.msg_connected_bluetooth), getString(R.string.thermometer)), String.format(getString(R.string.msg_connected_bluetooth), getString(R.string.thermometer)),
...@@ -248,12 +264,14 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity { ...@@ -248,12 +264,14 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
@Override @Override
public void onDisConnectionState() { // 切断 public void onDisConnectionState() { // 切断
Logger.d(TAG, "onDisConnectionState");
putUserPref(UserPrefKey.BLUETOOTH_DEVICE_TEMPERATURE_CONNECTED, 0); putUserPref(UserPrefKey.BLUETOOTH_DEVICE_TEMPERATURE_CONNECTED, 0);
ABVToastUtil.showMakeText(getApplicationContext(), getString(R.string.msg_ble_not_connect), Toast.LENGTH_SHORT); ABVToastUtil.showMakeText(getApplicationContext(), getString(R.string.msg_ble_not_connect), Toast.LENGTH_SHORT);
} }
@Override @Override
public void onGetDeviceInfo(String strTemp) { // 機器のデータ public void onGetDeviceInfo(String strTemp) { // 機器のデータ
Logger.d(TAG, "onDisConnectionState");
Toast.makeText( getApplicationContext(), strTemp, Toast.LENGTH_SHORT ).show(); Toast.makeText( getApplicationContext(), strTemp, Toast.LENGTH_SHORT ).show();
Logger.d(TAG, "get temperature [%s]", strTemp); Logger.d(TAG, "get temperature [%s]", strTemp);
setThermometerData(strTemp); setThermometerData(strTemp);
...@@ -261,10 +279,16 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity { ...@@ -261,10 +279,16 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
@Override @Override
public void onGetDeviceInfoFailed() { // 機器のエラー public void onGetDeviceInfoFailed() { // 機器のエラー
Logger.d(TAG, "onDisConnectionState");
putUserPref(UserPrefKey.BLUETOOTH_DEVICE_TEMPERATURE_CONNECTED, 0); putUserPref(UserPrefKey.BLUETOOTH_DEVICE_TEMPERATURE_CONNECTED, 0);
ABookAlertDialog alert = AlertDialogUtil.createAlertDialog(ABVContentViewActivity.this, R.string.thermometer); ABookAlertDialog alert = AlertDialogUtil.createAlertDialog(ABVContentViewActivity.this, R.string.thermometer);
alert.setMessage(String.format(getString(R.string.msg_ble_connect_error), getString(R.string.thermometer), getString(R.string.thermometer))); alert.setMessage(String.format(getString(R.string.msg_ble_connect_error), getString(R.string.thermometer), getString(R.string.thermometer)));
alert.setButton(DialogInterface.BUTTON_POSITIVE, getString(R.string.ok), (DialogInterface.OnClickListener) null); alert.setButton(DialogInterface.BUTTON_POSITIVE, getString(R.string.ok), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
setThermometerData("");
}
});
alert.show(); alert.show();
} }
}); });
...@@ -1440,7 +1464,17 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity { ...@@ -1440,7 +1464,17 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
// 接続 // 接続
bleManagerUtil.connect(); bleManagerUtil.connect();
} else { } else {
setPairingSetting(); // 接続するのために機器設定画面に遷移する。 // 設定画面に遷移すること
// setPairingSetting(); // 接続するのために機器設定画面に遷移する。
// ディバイス情報がない場合
ABookAlertDialog alert = AlertDialogUtil.createAlertDialog(ABVContentViewActivity.this, R.string.thermometer);
alert.setMessage(getString(R.string.msg_no_device_info));
alert.setButton(DialogInterface.BUTTON_POSITIVE, getString(R.string.ok), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
setThermometerData("");
}
});
} }
} else { } else {
Logger.w(TAG,"onGetDeviceInfoFailed Connect BLE Device false"); Logger.w(TAG,"onGetDeviceInfoFailed Connect BLE Device false");
......
...@@ -74,8 +74,8 @@ public class PairingSettingActivity extends ABVUIActivity implements AdapterView ...@@ -74,8 +74,8 @@ public class PairingSettingActivity extends ABVUIActivity implements AdapterView
@Override @Override
public void run() { public void run() {
BluetoothDevice device = result.getDevice(); BluetoothDevice device = result.getDevice();
// if(device.getName() != null && device.getName().startsWith("MF500B")) { // 識別商品名に絞る
if(device.getName() != null && device.getName().startsWith("MF500")) {
Map<String, String> map = new HashMap<String, String>(); Map<String, String> map = new HashMap<String, String>();
map.put(EXTRAS_DEVICE_NAME, device.getName()); map.put(EXTRAS_DEVICE_NAME, device.getName());
map.put(EXTRAS_DEVICE_ADDRESS, device.getAddress()); map.put(EXTRAS_DEVICE_ADDRESS, device.getAddress());
...@@ -85,6 +85,7 @@ public class PairingSettingActivity extends ABVUIActivity implements AdapterView ...@@ -85,6 +85,7 @@ public class PairingSettingActivity extends ABVUIActivity implements AdapterView
mBleListAdapter.addDevice(map); mBleListAdapter.addDevice(map);
} }
} }
}
} ); } );
} }
...@@ -101,6 +102,9 @@ public class PairingSettingActivity extends ABVUIActivity implements AdapterView ...@@ -101,6 +102,9 @@ public class PairingSettingActivity extends ABVUIActivity implements AdapterView
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.pairing_setting); setContentView(R.layout.pairing_setting);
TextView deviceTitle = (TextView) findViewById(R.id.device_toolbar_title);
deviceTitle.setText(R.string.thermometer);
// 戻り値の初期化 // 戻り値の初期化
setResult( Activity.RESULT_CANCELED ); setResult( Activity.RESULT_CANCELED );
...@@ -144,7 +148,15 @@ public class PairingSettingActivity extends ABVUIActivity implements AdapterView ...@@ -144,7 +148,15 @@ public class PairingSettingActivity extends ABVUIActivity implements AdapterView
// Bluetoothと接続処理する // Bluetoothと接続処理する
bleManagerUtil = new BleManagerUtil(this, new BleManagerUtil.BleManagerUtilListener() { bleManagerUtil = new BleManagerUtil(this, new BleManagerUtil.BleManagerUtilListener() {
@Override @Override
public void onConnectionError() {
Logger.d(TAG, "onConnectionError");
closeProgressPopup();
}
@Override
public void onConnectionState() { // 接続 public void onConnectionState() { // 接続
Logger.d(TAG, "onConnectionState");
closeProgressPopup();
Map<String, String> map = new HashMap<String, String>(); Map<String, String> map = new HashMap<String, String>();
map.put(EXTRAS_DEVICE_NAME, bleManagerUtil.mDeviceName); map.put(EXTRAS_DEVICE_NAME, bleManagerUtil.mDeviceName);
map.put(EXTRAS_DEVICE_ADDRESS, bleManagerUtil.mDeviceAddress); map.put(EXTRAS_DEVICE_ADDRESS, bleManagerUtil.mDeviceAddress);
...@@ -159,6 +171,8 @@ public class PairingSettingActivity extends ABVUIActivity implements AdapterView ...@@ -159,6 +171,8 @@ public class PairingSettingActivity extends ABVUIActivity implements AdapterView
@Override @Override
public void onDisConnectionState() { // 切断 public void onDisConnectionState() { // 切断
Logger.d(TAG, "onDisConnectionState");
closeProgressPopup();
// mDeviceListAdapter.notifyDataSetChanged(); // mDeviceListAdapter.notifyDataSetChanged();
Map<String, String> map = new HashMap<String, String>(); Map<String, String> map = new HashMap<String, String>();
map.put(EXTRAS_DEVICE_NAME, bleManagerUtil.mDeviceName); map.put(EXTRAS_DEVICE_NAME, bleManagerUtil.mDeviceName);
...@@ -176,20 +190,23 @@ public class PairingSettingActivity extends ABVUIActivity implements AdapterView ...@@ -176,20 +190,23 @@ public class PairingSettingActivity extends ABVUIActivity implements AdapterView
@Override @Override
public void onGetDeviceInfo(String strTemp) { // 機器のデータ public void onGetDeviceInfo(String strTemp) { // 機器のデータ
Logger.d(TAG, "onGetDeviceInfo");
closeProgressPopup();
// Toast.makeText( getApplicationContext(), R.string.msg_connected_bluetooth, Toast.LENGTH_SHORT ).show(); // Toast.makeText( getApplicationContext(), R.string.msg_connected_bluetooth, Toast.LENGTH_SHORT ).show();
Logger.d(TAG, "get temperature [%s]", strTemp); Logger.d(TAG, "get temperature [%s]", strTemp);
} }
@Override @Override
public void onGetDeviceInfoFailed() { // 機器のエラー public void onGetDeviceInfoFailed() { // 機器のエラー
Logger.d(TAG, "onGetDeviceInfoFailed");
closeProgressPopup();
showConfirmAlert( R.string.thermometer, String.format(getString(R.string.msg_ble_connect_error), getString(R.string.thermometer), getString(R.string.thermometer))); showConfirmAlert( R.string.thermometer, String.format(getString(R.string.msg_ble_connect_error), getString(R.string.thermometer), getString(R.string.thermometer)));
} }
}); });
bleManagerUtil.startDeviceInfo(); bleManagerUtil.startDeviceInfo();
// Scan Button // Reload Button
mButton_Scan = (Button)findViewById( R.id.scan_button ); mButton_Scan = (Button)findViewById( R.id.btn_reload );
mButton_Scan.setAllCaps(false); mButton_Scan.setAllCaps(false);
mButton_Scan.setOnClickListener(new View.OnClickListener() { mButton_Scan.setOnClickListener(new View.OnClickListener() {
@Override @Override
...@@ -198,19 +215,6 @@ public class PairingSettingActivity extends ABVUIActivity implements AdapterView ...@@ -198,19 +215,6 @@ public class PairingSettingActivity extends ABVUIActivity implements AdapterView
} }
}); });
// Stop Button
mButton_Stop = (Button)findViewById( R.id.stop_button );
mButton_Stop.setAllCaps(false);
mButton_Stop.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
stopScan();
}
});
// 設定画面が表示する場合、スキャンボタンが見えないように
mButton_Stop.setVisibility(View.GONE);
// 保存されているディバイスの情報がある場合、リストに表示する。 // 保存されているディバイスの情報がある場合、リストに表示する。
if (getUserPref(AppDefType.UserPrefKey.BLUETOOTH_DEVICE_TEMPERATURE_ADDRESS, "").length() > 0) { if (getUserPref(AppDefType.UserPrefKey.BLUETOOTH_DEVICE_TEMPERATURE_ADDRESS, "").length() > 0) {
Map<String, String> getUserDataMap = new HashMap<String, String>(); Map<String, String> getUserDataMap = new HashMap<String, String>();
...@@ -233,9 +237,12 @@ public class PairingSettingActivity extends ABVUIActivity implements AdapterView ...@@ -233,9 +237,12 @@ public class PairingSettingActivity extends ABVUIActivity implements AdapterView
// デバイスのBluetooth機能の有効化要求 // デバイスのBluetooth機能の有効化要求
requestBluetoothFeature(); requestBluetoothFeature();
// ローカルに保存されているディバイスの情報がない場合処理を行う
if (getUserPref(AppDefType.UserPrefKey.BLUETOOTH_DEVICE_TEMPERATURE_ADDRESS, "").length() == 0) {
// スキャン開始 // スキャン開始
startScan(); startScan();
} }
}
// 別のアクティビティ(か別のアプリ)に移行したことで、バックグラウンドに追いやられた時 // 別のアクティビティ(か別のアプリ)に移行したことで、バックグラウンドに追いやられた時
@Override @Override
...@@ -296,6 +303,7 @@ public class PairingSettingActivity extends ABVUIActivity implements AdapterView ...@@ -296,6 +303,7 @@ public class PairingSettingActivity extends ABVUIActivity implements AdapterView
return; return;
} }
showProgressPopup(getRString(R.string.msg_device_search));
// スキャン開始(一定時間後にスキャン停止する) // スキャン開始(一定時間後にスキャン停止する)
mHandler.postDelayed( new Runnable() { mHandler.postDelayed( new Runnable() {
@Override @Override
...@@ -303,19 +311,14 @@ public class PairingSettingActivity extends ABVUIActivity implements AdapterView ...@@ -303,19 +311,14 @@ public class PairingSettingActivity extends ABVUIActivity implements AdapterView
mScanning = false; mScanning = false;
scanner.stopScan( mLeScanCallback ); scanner.stopScan( mLeScanCallback );
// ボタンの更新
mButton_Scan.setVisibility(View.VISIBLE);
mButton_Stop.setVisibility(View.GONE);
Logger.d(TAG, "scan in 10 sec"); Logger.d(TAG, "scan in 10 sec");
closeProgressPopup();
} }
}, SCAN_PERIOD ); }, SCAN_PERIOD );
mScanning = true; mScanning = true;
scanner.startScan( mLeScanCallback ); scanner.startScan( mLeScanCallback );
// ボタンの更新
mButton_Scan.setVisibility(View.GONE);
mButton_Stop.setVisibility(View.VISIBLE);
Logger.d(TAG, "start scan !!"); Logger.d(TAG, "start scan !!");
} }
...@@ -333,9 +336,6 @@ public class PairingSettingActivity extends ABVUIActivity implements AdapterView ...@@ -333,9 +336,6 @@ public class PairingSettingActivity extends ABVUIActivity implements AdapterView
mScanning = false; mScanning = false;
scanner.stopScan( mLeScanCallback ); scanner.stopScan( mLeScanCallback );
// ボタンの更新
mButton_Scan.setVisibility(View.VISIBLE);
mButton_Stop.setVisibility(View.GONE);
Logger.d(TAG, "stop scan !!"); Logger.d(TAG, "stop scan !!");
} }
...@@ -372,10 +372,23 @@ public class PairingSettingActivity extends ABVUIActivity implements AdapterView ...@@ -372,10 +372,23 @@ public class PairingSettingActivity extends ABVUIActivity implements AdapterView
} else { } else {
bleManagerUtil.mDeviceAddress = deviceAddress; bleManagerUtil.mDeviceAddress = deviceAddress;
bleManagerUtil.mDeviceName = deviceName; bleManagerUtil.mDeviceName = deviceName;
showProgressPopup(getString(R.string.msg_device_connecting));
// デバイスのBluetooth機能の有効化要求
requestBluetoothFeature();
// 接続
bleManagerUtil.connect(); bleManagerUtil.connect();
} }
} }
protected boolean testcheck() {
if (getUserPref(AppDefType.UserPrefKey.BLUETOOTH_DEVICE_TEMPERATURE_CONNECTED, 0) == 1) {
return true;
}
return false;
}
// 閉じるボタンの処理 // 閉じるボタンの処理
public void onClickCloseView(View v) { public void onClickCloseView(View v) {
finish(); finish();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment