Commit 6df2a5c2 by Kim Jinsung

#32918 置くだけセンサー実装

パーミッション関連実装
parent 4d7278ac
...@@ -62,9 +62,6 @@ public class ABVEnvironment { ...@@ -62,9 +62,6 @@ public class ABVEnvironment {
// Serverから取得したcontentVersion時のリソースパターンを一時的に保存するための変数 // Serverから取得したcontentVersion時のリソースパターンを一時的に保存するための変数
public int resourcePatternType; public int resourcePatternType;
// Serverから取得したmasterDataのfetchDateを一時的に保存するための変数
public String tempMasterDataFetchDate = "";
////////////////////////////// 定数 ////////////////////////////////// ////////////////////////////// 定数 //////////////////////////////////
private static final String ServerTimeKey = "ABook"; private static final String ServerTimeKey = "ABook";
......
...@@ -172,8 +172,8 @@ public class Constant { ...@@ -172,8 +172,8 @@ public class Constant {
// 連携機器の区分 // 連携機器の区分
public interface DeviceType { public interface DeviceType {
int thermomete = 1; // 芯温系 int thermomete = 1; // 中心温度計
int sensor = 2; // くだけセンサー int sensor = 2; // くだけセンサー
int barcode = 3; // バーコード int barcode = 3; // バーコード
} }
} }
...@@ -127,4 +127,8 @@ public class ABookKeys { ...@@ -127,4 +127,8 @@ public class ABookKeys {
public static final String CMD_GET_DEVICE_INFO = "getDeviceInfo"; // CMSのインターフェースのパラメータ:cmd public static final String CMD_GET_DEVICE_INFO = "getDeviceInfo"; // CMSのインターフェースのパラメータ:cmd
public static final String TASK_DEVICE_TYPE = "deviceType"; // CMSのインターフェースのパラメータ:devicetype public static final String TASK_DEVICE_TYPE = "deviceType"; // CMSのインターフェースのパラメータ:devicetype
public static final String TASK_QUESTION_ID = "qid"; // CMSのインターフェースのパラメータ:qid public static final String TASK_QUESTION_ID = "qid"; // CMSのインターフェースのパラメータ:qid
public static final String TASK_DEVICE_TYPE_PARAM1 = "param1"; // CMSのインターフェースのパラメータ:param1 (デバイスID)
public static final String TASK_DEVICE_TYPE_PARAM2 = "param2"; // CMSのインターフェースのパラメータ:param2(1:温度、2:湿度)
} }
...@@ -39,6 +39,10 @@ public class ABVDataCache { ...@@ -39,6 +39,10 @@ public class ABVDataCache {
private Date lastPresentTime = DateTimeUtil.getCurrentDate(); // 最後の通信時に取得したサーバの時間 private Date lastPresentTime = DateTimeUtil.getCurrentDate(); // 最後の通信時に取得したサーバの時間
private static final int SEVER_ALERT_INTERVAL = 30; //システム日付チェック前後期間(分) private static final int SEVER_ALERT_INTERVAL = 30; //システム日付チェック前後期間(分)
// Serverから取得したmasterDataのfetchDateを一時的に保存するための変数
public String tempMasterDataFetchDate = null;
/** /**
* 未指定ジャンルのID * 未指定ジャンルのID
* @since 1.0.0 * @since 1.0.0
...@@ -233,6 +237,7 @@ public class ABVDataCache { ...@@ -233,6 +237,7 @@ public class ABVDataCache {
defaultCategoryId = -1; defaultCategoryId = -1;
defaultGroupId = -1; defaultGroupId = -1;
urlPath = null; urlPath = null;
tempMasterDataFetchDate = null;
} }
public void setLastPresentTime(Date lasttime) { public void setLastPresentTime(Date lasttime) {
......
...@@ -39,7 +39,7 @@ import jp.agentec.adf.util.DateTimeUtil; ...@@ -39,7 +39,7 @@ import jp.agentec.adf.util.DateTimeUtil;
* FIXME: DBのトランザクションができていない * FIXME: DBのトランザクションができていない
* *
*/ */
public class ContentRefresher { public class ContentRefresher {
private static final String TAG = "ContentRefresher"; private static final String TAG = "ContentRefresher";
private static ContentRefresher instance; private static ContentRefresher instance;
...@@ -96,6 +96,7 @@ public class ContentRefresher { ...@@ -96,6 +96,7 @@ public class ContentRefresher {
contentDownloader.kickTask(); // waitingで止まらないように実行を促す contentDownloader.kickTask(); // waitingで止まらないように実行を促す
throw new ABVException(ABVExceptionCode.C_I_CONTENT_0002); throw new ABVException(ABVExceptionCode.C_I_CONTENT_0002);
} }
networkAdapter = ABVEnvironment.getInstance().networkAdapter; networkAdapter = ABVEnvironment.getInstance().networkAdapter;
if (networkAdapter != null && !networkAdapter.isNetworkConnected()) { // NWのチェック if (networkAdapter != null && !networkAdapter.isNetworkConnected()) { // NWのチェック
throw new NetworkDisconnectedException(); throw new NetworkDisconnectedException();
...@@ -161,15 +162,14 @@ public class ContentRefresher { ...@@ -161,15 +162,14 @@ public class ContentRefresher {
categoryLogic.initializeCategories(); // カテゴリ設定 categoryLogic.initializeCategories(); // カテゴリ設定
// マスタデータの最新更新された時のFetchDateを一時に保存する。 // マスタデータの最新更新された時のFetchDateを一時に保存する。
Logger.d(TAG, "before fetchDate : " + ABVEnvironment.getInstance().tempMasterDataFetchDate); Logger.d(TAG, "before fetchDate : " + ABVDataCache.getInstance().tempMasterDataFetchDate);
// CMSでメンテナンスされるHACCPマスタデータをアプリから取得できるようにJSONファイルを生成する。 // CMSでメンテナンスされるHACCPマスタデータをアプリから取得できるようにJSONファイルを生成する。
String fetchDate = masterDataLogic.initializeMasterData(ABVEnvironment.getInstance().tempMasterDataFetchDate); String fetchDate = masterDataLogic.initializeMasterData(ABVDataCache.getInstance().tempMasterDataFetchDate);
Logger.d(TAG, "after fetchDate : " + fetchDate); Logger.d(TAG, "after fetchDate : " + fetchDate);
if (fetchDate != null) { if (fetchDate != null) {
// マスタデータの最新更新された時のFetchDateを一時に保存する。 // マスタデータの最新更新された時のFetchDateを一時に保存する。
ABVEnvironment.getInstance().tempMasterDataFetchDate = fetchDate; ABVDataCache.getInstance().tempMasterDataFetchDate = fetchDate;
} }
if (interrupt) { // この時点で停止要求が来た場合先には進まない。(ServiceOption/Group/Categoryの更新は1セットで行う(トランザクションはそれぞれ別)) if (interrupt) { // この時点で停止要求が来た場合先には進まない。(ServiceOption/Group/Categoryの更新は1セットで行う(トランザクションはそれぞれ別))
......
...@@ -9,10 +9,7 @@ import jp.agentec.abook.abv.bl.acms.client.parameters.FetchDateParameters; ...@@ -9,10 +9,7 @@ import jp.agentec.abook.abv.bl.acms.client.parameters.FetchDateParameters;
import jp.agentec.abook.abv.bl.common.ABVEnvironment; import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.exception.ABVException; import jp.agentec.abook.abv.bl.common.exception.ABVException;
import jp.agentec.abook.abv.bl.common.exception.AcmsException; import jp.agentec.abook.abv.bl.common.exception.AcmsException;
import jp.agentec.abook.abv.bl.common.exception.NetworkDisconnectedException;
import jp.agentec.abook.abv.bl.common.log.Logger; import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.data.dao.AbstractDao;
import jp.agentec.abook.abv.bl.data.dao.AcmsDao;
import jp.agentec.adf.util.FileUtil; import jp.agentec.adf.util.FileUtil;
public class MasterDataLogic extends AbstractLogic { public class MasterDataLogic extends AbstractLogic {
...@@ -29,15 +26,6 @@ public class MasterDataLogic extends AbstractLogic { ...@@ -29,15 +26,6 @@ public class MasterDataLogic extends AbstractLogic {
* @since 1.0.0 * @since 1.0.0
*/ */
public String initializeMasterData(String lastFetchDate) { public String initializeMasterData(String lastFetchDate) {
// コンテンツバージョン用lastFetchDateの取得
AcmsDao dao = AbstractDao.getDao(AcmsDao.class);
String daoLastFetchDate = dao.selectContentVersionLastFetchDate();
// ローカルに保存されている fetchDateがない場合、contentversionのlastFetchDateを利用する。
if (lastFetchDate.length() < 1) {
lastFetchDate = daoLastFetchDate;
}
String fetchDate = null; String fetchDate = null;
try { try {
FetchDateParameters param = new FetchDateParameters(cache.getMemberInfo().sid, lastFetchDate); FetchDateParameters param = new FetchDateParameters(cache.getMemberInfo().sid, lastFetchDate);
......
...@@ -46,6 +46,13 @@ ...@@ -46,6 +46,13 @@
android:theme="@style/ABook" android:theme="@style/ABook"
android:allowBackup="false" android:allowBackup="false"
android:largeHeap="true" > android:largeHeap="true" >
<!-- LinkingビーコンIFの使用宣言 -->
<meta-data
android:name="com.nttdocomo.android.smartdeviceagent.feature.beacon"
android:value="true" />
<!-- LinkingビーコンIFの使用宣言 -->
<service android:name="jp.agentec.abook.abv.cl.push.ABVFcmListenerService"> <service android:name="jp.agentec.abook.abv.cl.push.ABVFcmListenerService">
<intent-filter> <intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"></action> <action android:name="com.google.firebase.MESSAGING_EVENT"></action>
......
...@@ -1394,6 +1394,7 @@ ...@@ -1394,6 +1394,7 @@
<string name="set_title_pairing">ペアリング</string> <string name="set_title_pairing">ペアリング</string>
<string name="set_pairing_central_thermometer">中心温度計</string> <string name="set_pairing_central_thermometer">中心温度計</string>
<string name="pairing_search_scan">スキャン</string> <string name="pairing_search_scan">スキャン</string>
<string name="pairing_search_scaning">スキャン中..</string>
<string name="pairing_search_stop">中止</string> <string name="pairing_search_stop">中止</string>
<string name="pairing_save_thermometer">登録された温度計</string> <string name="pairing_save_thermometer">登録された温度計</string>
<string name="pairing_other_thermometer">その他温度計</string> <string name="pairing_other_thermometer">その他温度計</string>
...@@ -1403,15 +1404,23 @@ ...@@ -1403,15 +1404,23 @@
<string name="ble_disconnect">未接続</string> <string name="ble_disconnect">未接続</string>
<string name="ble_connecting">接続中..</string> <string name="ble_connecting">接続中..</string>
<string name="ble_connect_success">接続済み</string> <string name="ble_connect_success">接続済み</string>
<string name="msg_no_device_info">登録された中心温度計情報がありません。\n設定画面のペアリングの中心温度計から登録できます。</string>alert <string name="msg_no_device_info">登録された中心温度計情報がありません。\n設定画面のペアリングの中心温度計から登録できます。</string>
<string name="title_okudake_sensor">置くだけセンサー</string>
<string name="msg_ble_connect_error">登録した中心温度計と接続することができません。中心温度計の電源を確認した後、再度お試しください。(%s)</string>
<string name="msg_ble_connect_success">中心温度計と接続になりました。中心温度計を操作してください。</string>
<string name="msg_scan_bluetooth_no_allow">BlueToothの利用を「許可」しないと、中心温度計のスキャンができません。</string>
<string name="msg_thermometer_connect_bluetooth_no_allow">BlueToothの利用を「許可」しないと、中心温度計と接続できません。</string>
<string name="msg_okudake_connect_bluetooth_no_allow">BlueToothの利用を「許可」しないと、置くだけセンサーと接続できません。</string>
<string name="msg_okudake_location_device_no_allow">端末の設定から位置情報をONにしてください。</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="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_permission_dialog_bluetooth">ブルートゥース利用権限が必要です。\nアプリ設定画面へ遷移します。</string> <string name="msg_permission_dialog_bluetooth">ブルートゥース利用権限が必要です。\nアプリ設定画面へ遷移します。</string>
<string name="sensor">センサー</string> <string name="sensor">センサー</string>
<string name="barcode">バーコード</string> <string name="barcode">バーコード</string>
......
...@@ -1401,6 +1401,7 @@ ...@@ -1401,6 +1401,7 @@
<string name="set_title_pairing">패어링</string> <string name="set_title_pairing">패어링</string>
<string name="set_pairing_central_thermometer">중심 온도계</string> <string name="set_pairing_central_thermometer">중심 온도계</string>
<string name="pairing_search_scan">스캔</string> <string name="pairing_search_scan">스캔</string>
<string name="pairing_search_scaning">스캔중..</string>
<string name="pairing_search_stop">중지</string> <string name="pairing_search_stop">중지</string>
<string name="pairing_save_thermometer">등록된 온도계</string> <string name="pairing_save_thermometer">등록된 온도계</string>
<string name="pairing_other_thermometer">그 밖에 온도계</string> <string name="pairing_other_thermometer">그 밖에 온도계</string>
...@@ -1410,13 +1411,19 @@ ...@@ -1410,13 +1411,19 @@
<string name="ble_connecting">접속 시도 중..</string> <string name="ble_connecting">접속 시도 중..</string>
<string name="ble_connect_success">접속 완료</string> <string name="ble_connect_success">접속 완료</string>
<string name="msg_no_device_info">등록된 중심 온도계 정보가 없습니다.\n 설정 화면의 페어링의 중심 온도계에서 등록 가능합니다.</string> <string name="msg_no_device_info">등록된 중심 온도계 정보가 없습니다.\n 설정 화면의 페어링의 중심 온도계에서 등록 가능합니다.</string>
<string name="title_okudake_sensor">오쿠다케 센서</string>
<string name="msg_ble_connect_error">등록한 중심 온도계와 연결 할 수 없습니다. 중심 온도계의 전원을 확인후 다시 시도해 주시기 바랍니다.(%s)</string>
<string name="msg_ble_connect_success">중심 온도계와 연결되었습니다. 중심 온도계를 조작 해 주세요.</string>
<string name="msg_scan_bluetooth_no_allow">블루투스 사용를 [허용] 하지 않으면, 중심 온도계 스캔이 불가능 합니다. </string>
<string name="msg_thermometer_connect_bluetooth_no_allow">블루투스 사용를 [허용] 하지 않으면, 중심 온도계와 연결이 불가능 합니다.</string>
<string name="msg_okudake_connect_bluetooth_no_allow">블루투스 사용를 [허용] 하지 않으면, 오쿠다케 센서와 연결이 불가능 합니다.</string>
<string name="msg_okudake_location_device_no_allow">단말기의 설정에서 위치정보를 ON으로 설정해 주세요.</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="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_permission_dialog_bluetooth">블루투스이용권한이 필요합니다.\n설정화면으로 이동합니다.</string> <string name="msg_permission_dialog_bluetooth">블루투스이용권한이 필요합니다.\n설정화면으로 이동합니다.</string>
<string name="sensor">센서</string> <string name="sensor">센서</string>
<string name="barcode">바코드</string> <string name="barcode">바코드</string>
......
...@@ -1400,6 +1400,7 @@ ...@@ -1400,6 +1400,7 @@
<string name="set_title_pairing">Pairing</string> <string name="set_title_pairing">Pairing</string>
<string name="set_pairing_central_thermometer">Central thermometer</string> <string name="set_pairing_central_thermometer">Central thermometer</string>
<string name="pairing_search_scan">Scan</string> <string name="pairing_search_scan">Scan</string>
<string name="pairing_search_scaning">Scaning..</string>
<string name="pairing_search_stop">Stop</string> <string name="pairing_search_stop">Stop</string>
<string name="pairing_save_thermometer">Saved thermometer</string> <string name="pairing_save_thermometer">Saved thermometer</string>
<string name="pairing_other_thermometer">Other thermometer</string> <string name="pairing_other_thermometer">Other thermometer</string>
...@@ -1409,14 +1410,20 @@ ...@@ -1409,14 +1410,20 @@
<string name="ble_connecting">Connection..</string> <string name="ble_connecting">Connection..</string>
<string name="ble_connect_success">Connected</string> <string name="ble_connect_success">Connected</string>
<string name="msg_no_device_info">There is no registered central thermometer information. \n You can register in the center thermometer of the pairing of setting screen.</string> <string name="msg_no_device_info">There is no registered central thermometer information. \n You can register in the center thermometer of the pairing of setting screen.</string>
<string name="title_okudake_sensor">OKUDAKE SENSOR</string>
<string name="msg_ble_connect_error">You can not connect to the registered center thermometer. Check the power supply of the central thermometer and try again.(%s)</string>
<string name="msg_ble_connect_success">Connected with the center thermometer. Please control the central thermometer.</string>
<string name="msg_scan_bluetooth_no_allow">If Bluetooth is not allow, the center thermometer scan is disabled.</string>
<string name="msg_thermometer_connect_bluetooth_no_allow">If Bluetooth is not allow, the center thermometer connect is disabled.</string>
<string name="msg_okudake_connect_bluetooth_no_allow">If Bluetooth is not allow, the center okudake sensor connect is disabled.</string>
<string name="msg_okudake_location_device_no_allow">Please set the location information to ON in the device setting.</string>
<string name="ble_is_not_supported">BLE is not supported.</string> <string name="ble_is_not_supported">BLE is not supported.</string>
<string name="bluetooth_is_not_supported">Bluetooth is not supported.</string> <string name="bluetooth_is_not_supported">Bluetooth is not supported.</string>
<string name="bluetooth_is_not_working">Bluetooth is not working.</string>
<string name="msg_connected_bluetooth">Connected to %s</string> <string name="msg_connected_bluetooth">Connected to %s</string>
<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_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="sensor">Sensor</string> <string name="sensor">Sensor</string>
<string name="barcode">Barcode</string> <string name="barcode">Barcode</string>
......
...@@ -21,6 +21,7 @@ dependencies { ...@@ -21,6 +21,7 @@ dependencies {
implementation project(':xwalk_core_library') implementation project(':xwalk_core_library')
implementation files('libs/FoxitRDK.jar') implementation files('libs/FoxitRDK.jar')
implementation project(':SwiftDecoderMobile') implementation project(':SwiftDecoderMobile')
implementation files('libs/sdaiflib.jar')
} }
android { android {
......
...@@ -27,16 +27,6 @@ ...@@ -27,16 +27,6 @@
android:gravity="left|center_vertical" android:gravity="left|center_vertical"
android:textSize="20sp" /> android:textSize="20sp" />
<TextView
android:id="@+id/bl_subTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="1"
android:padding="3dp"
android:text="connection.."
android:textColor="@android:color/darker_gray"
android:textSize="17sp" />
</LinearLayout> </LinearLayout>
<Button <Button
......
package jp.agentec.abook.abv.cl.util; package jp.agentec.abook.abv.cl.util;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.List;
import java.util.UUID;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.launcher.android.R;
import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothGatt; import android.bluetooth.BluetoothGatt;
...@@ -19,10 +11,16 @@ import android.bluetooth.BluetoothManager; ...@@ -19,10 +11,16 @@ import android.bluetooth.BluetoothManager;
import android.bluetooth.BluetoothProfile; import android.bluetooth.BluetoothProfile;
import android.content.Context; import android.content.Context;
import android.os.Build; import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.widget.Toast; import android.widget.Toast;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.List;
import java.util.UUID;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.launcher.android.R;
import static android.bluetooth.BluetoothDevice.TRANSPORT_LE; import static android.bluetooth.BluetoothDevice.TRANSPORT_LE;
import static org.chromium.base.ThreadUtils.runOnUiThread; import static org.chromium.base.ThreadUtils.runOnUiThread;
...@@ -66,13 +64,14 @@ public class BleManagerUtil { ...@@ -66,13 +64,14 @@ public class BleManagerUtil {
// }); // });
// return; // return;
// } // }
Logger.d("GATT_ message : [ " + status); final int fStatus = status;
// ディバイスと接続されていない場合のメッセージコード:133, 62 // ディバイスと接続されていない場合のメッセージコード:133, 62
// ディバイスと接続が切れた場合のメッセージコード:19 // ディバイスと接続が切れた場合のメッセージコード:19
if (status == 133 || status == 62) { // 接続失敗 if (status == 133 || status == 62) { // 接続失敗
runOnUiThread( new Runnable() { runOnUiThread( new Runnable() {
public void run() { public void run() {
listener.onConnectionError(); Logger.e("onConnectionStateChange status = " + fStatus);
listener.onConnectionError(fStatus);
} }
}); });
return; return;
...@@ -81,9 +80,11 @@ public class BleManagerUtil { ...@@ -81,9 +80,11 @@ public class BleManagerUtil {
if( status == BluetoothGatt.GATT_SUCCESS && BluetoothProfile.STATE_CONNECTED == newState ) { if( status == BluetoothGatt.GATT_SUCCESS && BluetoothProfile.STATE_CONNECTED == newState ) {
// 接続完了 // 接続完了
if (!mBluetoothGatt.discoverServices()) { // サービス検索 if (!mBluetoothGatt.discoverServices()) { // サービス検索
runOnUiThread( new Runnable() { // 接続失敗 runOnUiThread( new Runnable() { // 接続失敗
public void run() { public void run() {
listener.onGetDeviceInfoFailed(); listener.onGetDeviceInfoFailed(fStatus);
Logger.e("onConnectionStateChange2 status = " + fStatus);
} }
}); });
} }
...@@ -210,10 +211,10 @@ public class BleManagerUtil { ...@@ -210,10 +211,10 @@ public class BleManagerUtil {
*/ */
public interface BleManagerUtilListener { public interface BleManagerUtilListener {
void onGetDeviceInfo(String strTemperature); // ディバイスから渡す情報 void onGetDeviceInfo(String strTemperature); // ディバイスから渡す情報
void onGetDeviceInfoFailed(); // ディバイスと接続失敗時の情報渡す。 void onGetDeviceInfoFailed(int status); // ディバイスと接続失敗時の情報渡す。
void onConnectionState(); // ディバイスと接続された時情報渡す。 void onConnectionState(); // ディバイスと接続された時情報渡す。
void onDisConnectionState(); // ディバイスと切断時 void onDisConnectionState(); // ディバイスと切断時
void onConnectionError(); // ディバイス接続エラー void onConnectionError(int status); // ディバイス接続エラー
} }
// 接続 // 接続
......
...@@ -8,7 +8,10 @@ import android.support.multidex.MultiDexApplication; ...@@ -8,7 +8,10 @@ import android.support.multidex.MultiDexApplication;
import jp.agentec.abook.abv.bl.common.ABVEnvironment; import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.log.Logger; import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.data.ABVDataCache;
import jp.agentec.abook.abv.cl.helper.ABVUncaughtExceptionHandler; import jp.agentec.abook.abv.cl.helper.ABVUncaughtExceptionHandler;
import jp.agentec.abook.abv.cl.util.PreferenceUtil;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType;
import jp.agentec.abook.abv.ui.common.util.Initializer; import jp.agentec.abook.abv.ui.common.util.Initializer;
import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper; import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper;
import jp.agentec.adf.util.FileUtil; import jp.agentec.adf.util.FileUtil;
...@@ -49,6 +52,9 @@ public class ABVApplication extends MultiDexApplication { ...@@ -49,6 +52,9 @@ public class ABVApplication extends MultiDexApplication {
//添付ファイル臨時保存場所削除 //添付ファイル臨時保存場所削除
FileUtil.delete(ABVEnvironment.getInstance().getCacheTempAttachedImageDirPath()); FileUtil.delete(ABVEnvironment.getInstance().getCacheTempAttachedImageDirPath());
// masterDataの fetchDateのローカルに保存された値を取得し、新着更新時に利用するため、セットして置く。
ABVDataCache.getInstance().tempMasterDataFetchDate = PreferenceUtil.getUserPref(this, AppDefType.UserPrefKey.MASTER_DATA_FETCH_DATE, null);
} }
@Override @Override
......
package jp.agentec.abook.abv.ui.common.activity;
import android.app.Activity;
import android.bluetooth.BluetoothAdapter;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.location.LocationManager;
import android.os.Build;
import android.os.Bundle;
import android.widget.Toast;
import com.nttdocomo.android.sdaiflib.BeaconData;
import com.nttdocomo.android.sdaiflib.BeaconReceiverBase;
import com.nttdocomo.android.sdaiflib.BeaconScanner;
import com.nttdocomo.android.sdaiflib.Define;
import org.json.adf.JSONObject;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.Map;
import jp.agentec.abook.abv.bl.common.Constant;
import jp.agentec.abook.abv.bl.common.constant.ABookKeys;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.cl.util.BleManagerUtil;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType;
import jp.agentec.abook.abv.ui.common.dialog.ABookAlertDialog;
import jp.agentec.abook.abv.ui.common.util.ABVToastUtil;
import jp.agentec.abook.abv.ui.common.util.AlertDialogUtil;
import jp.agentec.abook.abv.ui.home.activity.BarCodeReaderActivity;
import jp.agentec.abook.abv.ui.home.helper.ABookPermissionHelper;
public class ABVCheckContentViewActivity extends ABVContentViewActivity {
private static final String TAG ="ABVCheckContentViewActivity";
//置くだけセンサースキャナー
private BeaconScanner mScanner;
//置くだけセンサーBeacon受信
private BeaconReceiver mReceiver;
//置くだけセンサースキャン状態
protected boolean isBeaconScaning = false;
//デフォルトのスキャンモード(0:高精度モード , 1:通常モード, 2:省電力モード, 3:通常モード)
//通常モードが一番早くBeacon受信できるのでデフォルト値を3も設定
private static final int DEFAULT_SCAN_MODE = 3;
private static final String LOG_SEPARATOR = "\n========================\n";
private static final SimpleDateFormat SDF = new SimpleDateFormat("HH:mm:ss.SSS", Locale.JAPANESE);
//置くだけセンサーのサービスID
private static final int OKUDAKE_SERVICE_ID_TEMPERATURE = 1;
private static final int OKUDAKE_SERVICE_ID_HUMIDITY = 2;
// 定数
public static final int REQUEST_CODE_ENABLEBLUETOOTH_TEMPERATURE = 2001; // Bluetooth機能の有効化要求時の識別コード
public static final int REQUEST_CODE_ENABLEBLUETOOTH_OKUDAKE = 2002; // Bluetooth機能の有効化要求時の識別コード
public final static int REQUEST_CODE_BARCODE_READER = 2003; // バーコードリーダの職別コード
// メンバー変数
public String mDeviceAddress = ""; // デバイスアドレス
private BleManagerUtil bleManagerUtil; // Bluetoothの接続
// 機器連携のコマンドの設問ID
public String mQid = "";
//待ち状態の時画面に表示するダイアログ
protected ABookAlertDialog mWaitingDialog;
//置くだけセンサースキャンするデバイスID
private int mScaningDeviceId;
//置くだけセンサースキャンするデバイス情報タイプ(1:温度、2:湿度)
private int mScaningServiceId;
//デバイスタイプ(1:中心温度計、2:置くだけセンサー、3:バーコード)
private int mDeviceType;
/**
* Beaconスキャン結果受信Receiver.
*/
private class BeaconReceiver extends BeaconReceiverBase {
@Override
protected void onReceiveScanResult(BeaconData data) {
//選択されたデバイスIDから端末検索
if (data.getExtraId() == mScaningDeviceId) {
String value = "-1";
switch (mScaningServiceId) {
case OKUDAKE_SERVICE_ID_TEMPERATURE:
value = String.valueOf(data.getTemperature());
break;
case OKUDAKE_SERVICE_ID_HUMIDITY:
value = String.valueOf(data.getHumidity());
break;
default:
value = String.valueOf(data.getTemperature());
break;
}
//HTML側に値送信
successAfterAbookCheckAip(value);
//置くだけセンサーのスキャン中止
stopOkudakeBeaconScan();
//待機中のダイヤログ非表示
dismissWaitngDialog();
}
//デバイス情報ログ出力
StringBuilder sb = new StringBuilder();
sb.append(LOG_SEPARATOR);
sb.append("\nビーコンスキャン結果");
sb.append("\n通知時刻: " + SDF.format(new Date()));
sb.append("\n検出時刻: " + SDF.format(new Date(data.getTimestamp())));
sb.append("\nベンダ識別子: " + data.getVendorId());
sb.append("\n個別番号: " + data.getExtraId());
sb.append("\nRSSI値: " + data.getRssi());
sb.append("\nバージョン: " + data.getVersion());
sb.append("\n距離種別: " + data.getDistance());
sb.append("\nTxパワー: " + data.getTxPower());
sb.append("\n温度(℃): " + data.getTemperature());
sb.append("\n湿度(%): " + data.getHumidity());
sb.append("\n気圧(hPa): " + data.getAtmosphericPressure());
sb.append("\n電池残量低下(要充電)フラグ: " + data.getLowBattery());
sb.append("\n電池残量(%): " + data.getBatteryPower());
sb.append("\nボタン識別子: " + data.getButtonId());
sb.append("\n開閉フラグ: " + data.getOpenCloseSensor());
sb.append("\n人感反応有無フラグ: " + data.getHumanSensor());
sb.append("\nRawデータ(ビーコンサービスID 8): " + data.getRawData8());
sb.append("\nRawデータ(ビーコンサービスID 9): " + data.getRawData9());
sb.append("\nRawデータ(ビーコンサービスID 10): " + data.getRawData10());
sb.append("\nRawデータ(ビーコンサービスID 11): " + data.getRawData11());
sb.append("\nRawデータ(ビーコンサービスID 12): " + data.getRawData12());
sb.append("\nRawデータ(ビーコンサービスID 13): " + data.getRawData13());
sb.append("\nRawデータ " + data.getRawData());
sb.append('\n');
Logger.d(sb.toString());
}
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
/** 置くだけセンサーデバイス関連 開始 **/
//ビーコンスキャナー
mScanner = new BeaconScanner(this);
//ビーコンレシーバー
mReceiver = new BeaconReceiver();
//Filter
IntentFilter filter = new IntentFilter();
filter.addAction(Define.filterBeaconScanResult);
filter.addAction(Define.filterBeaconScanState);
//Beacon受信開始
registerReceiver(mReceiver, filter);
/** 置くだけセンサーデバイス関連 終了 **/
/** 中心温度計デバイス関連 開始 **/
bleManagerUtil = new BleManagerUtil(this, new BleManagerUtil.BleManagerUtilListener() {
@Override
public void onConnectionError(int status) { //中心温度計接続エラー
Logger.e(TAG, "onConnectionError");
errorAfterAbookCheckAip(String.format(getString(R.string.msg_ble_connect_error), String.valueOf(status)));
bleThermometerDisconnect();
}
@Override
public void onConnectionState() { // 中心温度計接続成功
Logger.d(TAG, "onConnectionState");
mWaitingDialog.setMessage(getString(R.string.msg_ble_connect_success));
}
@Override
public void onDisConnectionState() { // 中心温度計接続切断
Logger.d(TAG, "onDisConnectionState");
// ABVToastUtil.showMakeText(getApplicationContext(), getString(R.string.msg_ble_not_connect), Toast.LENGTH_SHORT);
setThermometerData("");
dismissWaitngDialog();
}
@Override
public void onGetDeviceInfo(String strTemp) { // 中心温度計からデータ取得成功
Logger.d(TAG, "onGetDeviceInfo");
Toast.makeText( getApplicationContext(), strTemp, Toast.LENGTH_SHORT ).show();
Logger.d(TAG, "get temperature [%s]", strTemp);
setThermometerData(strTemp);
bleThermometerDisconnect();
}
@Override
public void onGetDeviceInfoFailed(int status) { // 中心温度計からデータ取得エラー
Logger.e(TAG, "onGetDeviceInfoFailed");
errorAfterAbookCheckAip(String.format(getString(R.string.msg_ble_connect_error), String.valueOf(status)));
dismissWaitngDialog();
bleThermometerDisconnect();
}
});
bleManagerUtil.startDeviceInfo();
/** 中心温度計デバイス関連 終了 **/
}
@Override
protected void onDestroy() {
//Beacon受信停止
unregisterReceiver(mReceiver);
// 接続されている機器と切断する。
if( null != bleManagerUtil.mBluetoothGatt ) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
bleManagerUtil.mBluetoothGatt.disconnect();
}
}
super.onDestroy();
}
@Override
public void onPause() {
super.onPause();
}
@Override
protected void onActivityResult( int requestCode, int resultCode, Intent data ) {
switch(requestCode) {
case REQUEST_CODE_ENABLEBLUETOOTH_TEMPERATURE: // 中心温度計Bluetooth有効化要求
if( Activity.RESULT_CANCELED == resultCode ) { // 有効にされなかった
ABVToastUtil.showMakeText(getApplicationContext(), getString(R.string.msg_thermometer_connect_bluetooth_no_allow), Toast.LENGTH_SHORT);
return;
} else {
setThermometerDeviceInfo();
}
break;
case REQUEST_CODE_ENABLEBLUETOOTH_OKUDAKE: // 置くだけセンサーBluetooth有効化要求
if( Activity.RESULT_CANCELED == resultCode ) { // 有効にされなかった
ABVToastUtil.showMakeText(getApplicationContext(), getString(R.string.msg_okudake_connect_bluetooth_no_allow), Toast.LENGTH_SHORT);
return;
} else {
startOkudakeBeaconScan();
}
break;
case REQUEST_CODE_BARCODE_READER: // バーコードの要求
if (data != null) { //バーコード画面から閉じるときにはdataがないので、値がある時のみセット
String value = data.getStringExtra(BarCodeReaderActivity.BARCODE_READING_DATA);
successAfterAbookCheckAip(value);
}
break;
}
super.onActivityResult( requestCode, resultCode, data );
}
/**
* ABVContentViewActivityからの呼ばれるメッソドで各種デバイスとの連携
* @param abookCheckParam HTML側からのパラメーター情報
*/
protected void getDeviceInfo(Map<String, String> abookCheckParam) {
if (abookCheckParam.containsKey(ABookKeys.TASK_DEVICE_TYPE)) {
mDeviceType = Integer.valueOf(abookCheckParam.get(ABookKeys.TASK_DEVICE_TYPE)); // ディバイスのタイプ取得
mQid = abookCheckParam.get(ABookKeys.TASK_QUESTION_ID); // 設問ID取得
// 1:中心温度計 2:置くだけセンサー 3:バーコード
if (mDeviceType == Constant.DeviceType.thermomete) { // 中心温度計
setThermometerDeviceInfo();
} else if (mDeviceType == Constant.DeviceType.sensor) { // 置くだけセンサー
mScaningDeviceId = Integer.valueOf(abookCheckParam.get(ABookKeys.TASK_DEVICE_TYPE_PARAM1)); // デバイスID取得
mScaningServiceId = Integer.valueOf(abookCheckParam.get(ABookKeys.TASK_DEVICE_TYPE_PARAM2)); // ServiceId ID取得
startOkudakeBeaconScan();
} else if (mDeviceType == Constant.DeviceType.barcode) { // バーコード
setBarcodeDeviceInfo();
} else {
Logger.e("外部デバイスタイプ不正 deviceType = " + mDeviceType);
}
} else {
Logger.e("外部デバイスタイプ不正 deviceType is null");
}
}
/**
* 置くだけセンサースキャン開始
*/
private void startOkudakeBeaconScan() {
//Linkingアプリと置くだけセンサーがBluetoothで通信するのでチェック必要
if (requestBluetoothFeature(REQUEST_CODE_ENABLEBLUETOOTH_OKUDAKE)) {
LocationManager lm = (LocationManager) this.getSystemService(this.LOCATION_SERVICE);
final boolean gpsEnabled = lm.isProviderEnabled(LocationManager.GPS_PROVIDER);
//端末側の位置情報許可チェック
if (gpsEnabled) {
ABookPermissionHelper helper = new ABookPermissionHelper(this, Constant.ABookPermissionType.AccessFineLocation, null);
//アプリ側の位置情報許可チェック(置くだけセンサーとLinkingアプリの通信できないため)
if (helper.checkMultiPermissions(true)) {
if (!isBeaconScaning) { //スキャン中状態ではない時だけスキャン開始
Logger.d("startOkudakeBeaconScan mScaningServiceId = " + mScaningServiceId);
showWaitingDialog(getString(R.string.title_okudake_sensor), getString(R.string.pairing_search_scaning));
isBeaconScaning = true;
int[] serviceIds = new int[] { mScaningServiceId };
mScanner.startScan(serviceIds, DEFAULT_SCAN_MODE);
}
}
} else {
errorAfterAbookCheckAip(getString(R.string.msg_okudake_location_device_no_allow));
}
}
}
/**
* 置くだけセンサースキャン中止
*/
private void stopOkudakeBeaconScan() {
if (mScanner != null) {
Logger.d("stopOkudakeBeaconScan");
mScanner.stopScan();
isBeaconScaning = false;
}
}
/**
* 中心温度計、置くだけセンサー接続の待機ダイヤログ表示
* @param title タイトル
* @param message 内容
*/
private void showWaitingDialog(String title, String message) {
//待機状態のダイヤログ表示
mWaitingDialog = AlertDialogUtil.createAlertDialog(this, title);
mWaitingDialog.setMessage(message);
mWaitingDialog.setButton(DialogInterface.BUTTON_POSITIVE, getResources().getString(R.string.pairing_search_stop), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
switch (mDeviceType) {
case Constant.DeviceType.thermomete:
bleThermometerDisconnect(); // 中心温度計接続切断
break;
case Constant.DeviceType.sensor:
stopOkudakeBeaconScan(); // 置くだけセンサースキャン中止
break;
}
successAfterAbookCheckAip("");
mWaitingDialog = null;
}
});
mWaitingDialog.show();
}
/**
* 中心温度計、置くだけセンサー接続の待機ダイヤログ非表示
*/
private void dismissWaitngDialog() {
if (mWaitingDialog != null) {
mWaitingDialog.dismiss();
mWaitingDialog = null;
}
}
/**
* BLEディバイスの中心温度計の情報取得
*/
private void setThermometerDeviceInfo() {
if (requestBluetoothFeature(REQUEST_CODE_ENABLEBLUETOOTH_TEMPERATURE)) { //端末のBluetooth設定を確認
String deviceAddress = getUserPref(AppDefType.UserPrefKey.BLUETOOTH_DEVICE_TEMPERATURE_ADDRESS, "");
if (deviceAddress.length() > 0) { //登録されている中心温度計がある
showWaitingDialog(getString(R.string.set_pairing_central_thermometer), getString(R.string.ble_connecting));
bleManagerUtil.mDeviceAddress = deviceAddress;
// 接続
bleManagerUtil.connect();
} else { //登録されている中心温度計がない
errorAfterAbookCheckAip(getString(R.string.msg_no_device_info));
setThermometerData("");
}
}
}
/**
* Android端末のBluetooth機能の有効化要求
* @return true:bluetooth ON, false:bluetooth OFF
*/
private boolean requestBluetoothFeature(int requestCode) {
if(bleManagerUtil.mBluetoothAdapter.isEnabled()) {
return true;
}
// デバイスのBluetooth機能が有効になっていないときは、有効化要求(ダイアログ表示)
Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
startActivityForResult(enableBtIntent, requestCode);
return false;
}
/**
* HTML側に中心温度計からのデータを転送する
* @param strTemp デバイスから受信された値
*/
private void setThermometerData(String strTemp) {
Logger.v(TAG, "thermometer [%s]", strTemp);
JSONObject thermometerDataJson = new JSONObject();
thermometerDataJson.put(ABookKeys.TASK_QUESTION_ID, mQid);
thermometerDataJson.put("value", strTemp);
afterABookCheckApi(mCmd, "", 0, "", thermometerDataJson.toString());
Logger.v(TAG, "thermometer JSON [%s]", thermometerDataJson.toString());
}
/**
* 中心温度計の接続を切る
*/
protected void bleThermometerDisconnect() {
bleManagerUtil.disconnect();
}
/**
* ディバイスのバーコードの情報取得
*/
private void setBarcodeDeviceInfo() {
//カメラパーミッションチェック
ABookPermissionHelper helper = new ABookPermissionHelper(ABVCheckContentViewActivity.this, Constant.ABookPermissionType.Camera, null);
if (!helper.checkMultiPermissions(true)) {
Logger.w(TAG,"startCameraIntent Camera Permission false");
return;
}
Intent barcodeactivityIntent = new Intent( this, BarCodeReaderActivity.class );
startActivityForResult( barcodeactivityIntent,REQUEST_CODE_BARCODE_READER);
}
/**
* 各デバイスから値を正常に取得された場合、HTML側にコールする
* @param value 各種デバイスから取得した値
*/
private void successAfterAbookCheckAip(String value) {
JSONObject responseJson = new JSONObject();
responseJson.put(ABookKeys.TASK_QUESTION_ID, mQid);
responseJson.put("value", value);
afterABookCheckApi(mCmd, "", 0, "", responseJson.toString());
Logger.d(TAG, "successAfterAbookCheckAip JSON [%s]", responseJson.toString());
}
/**
* 各デバイスからエラー(接続不能など)発生した場合、HTML側にコールする
* @param errorMessage 各種デバイスから取得した値
*/
private void errorAfterAbookCheckAip(String errorMessage) {
afterABookCheckApi(mCmd, "", 1, errorMessage, "");
}
}
package jp.agentec.abook.abv.ui.common.activity; package jp.agentec.abook.abv.ui.common.activity;
import android.app.Activity;
import android.bluetooth.BluetoothAdapter;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
...@@ -9,7 +7,6 @@ import android.content.pm.ActivityInfo; ...@@ -9,7 +7,6 @@ import android.content.pm.ActivityInfo;
import android.database.Cursor; import android.database.Cursor;
import android.location.Location; import android.location.Location;
import android.net.Uri; import android.net.Uri;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.provider.MediaStore; import android.provider.MediaStore;
...@@ -58,7 +55,6 @@ import jp.agentec.abook.abv.bl.websocket.MeetingManager; ...@@ -58,7 +55,6 @@ import jp.agentec.abook.abv.bl.websocket.MeetingManager;
import jp.agentec.abook.abv.cl.environment.DeviceInfo; import jp.agentec.abook.abv.cl.environment.DeviceInfo;
import jp.agentec.abook.abv.cl.helper.ContentMarkingFileHelper; import jp.agentec.abook.abv.cl.helper.ContentMarkingFileHelper;
import jp.agentec.abook.abv.cl.util.AndroidStringUtil; import jp.agentec.abook.abv.cl.util.AndroidStringUtil;
import jp.agentec.abook.abv.cl.util.BleManagerUtil;
import jp.agentec.abook.abv.cl.util.ContentLogUtil; import jp.agentec.abook.abv.cl.util.ContentLogUtil;
import jp.agentec.abook.abv.cl.util.LocationManagerUtil; import jp.agentec.abook.abv.cl.util.LocationManagerUtil;
import jp.agentec.abook.abv.cl.util.PreferenceUtil; import jp.agentec.abook.abv.cl.util.PreferenceUtil;
...@@ -73,8 +69,6 @@ import jp.agentec.abook.abv.ui.common.util.ABVToastUtil; ...@@ -73,8 +69,6 @@ import jp.agentec.abook.abv.ui.common.util.ABVToastUtil;
import jp.agentec.abook.abv.ui.common.util.AlertDialogUtil; import jp.agentec.abook.abv.ui.common.util.AlertDialogUtil;
import jp.agentec.abook.abv.ui.common.util.PatternStringUtil; import jp.agentec.abook.abv.ui.common.util.PatternStringUtil;
import jp.agentec.abook.abv.ui.common.view.ABVPopupListWindow; import jp.agentec.abook.abv.ui.common.view.ABVPopupListWindow;
import jp.agentec.abook.abv.ui.home.activity.BarCodeReaderActivity;
import jp.agentec.abook.abv.ui.home.activity.PairingSettingActivity;
import jp.agentec.abook.abv.ui.home.helper.ABookCheckWebViewHelper; import jp.agentec.abook.abv.ui.home.helper.ABookCheckWebViewHelper;
import jp.agentec.abook.abv.ui.home.helper.ABookPermissionHelper; import jp.agentec.abook.abv.ui.home.helper.ABookPermissionHelper;
import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper; import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper;
...@@ -143,17 +137,6 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity { ...@@ -143,17 +137,6 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
public int mButtonStatus; // 保存ボタンチェック public int mButtonStatus; // 保存ボタンチェック
protected boolean mAddReport; // 作業追加区分 protected boolean mAddReport; // 作業追加区分
// 定数
public static final int REQUEST_ENABLEBLUETOOTH = 1; // Bluetooth機能の有効化要求時の識別コード
public static final int REQUEST_CONNECTDEVICE = 2; // デバイス接続要求時の識別コード
public final static int REQUEST_BARCODE_READER = 3; // バーコードリーダの職別コード
// メンバー変数
public String mDeviceAddress = ""; // デバイスアドレス
private BleManagerUtil bleManagerUtil; // Bluetoothの接続
// 機器連携のコマンドの設問ID
public String mQid = "";
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
...@@ -220,68 +203,6 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity { ...@@ -220,68 +203,6 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
contentDownloader.pauseAll(); contentDownloader.pauseAll();
showUpdateContentAlert(contentId); showUpdateContentAlert(contentId);
// get Device info
bleManagerUtil = new BleManagerUtil(this, new BleManagerUtil.BleManagerUtilListener() {
@Override
public void onConnectionError() {
Logger.d(TAG, "onConnectionError");
putUserPref(UserPrefKey.BLUETOOTH_DEVICE_TEMPERATURE_CONNECTED, 0);
ABookAlertDialog alert = AlertDialogUtil.createAlertDialog(ABVContentViewActivity.this, R.string.set_pairing_central_thermometer);
alert.setMessage(String.format(getString(R.string.msg_ble_connect_error), getString(R.string.set_pairing_central_thermometer), getString(R.string.set_pairing_central_thermometer)));
alert.setButton(DialogInterface.BUTTON_POSITIVE, getString(R.string.ok), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
setThermometerData("");
bleManagerUtil.disconnect();
}
});
alert.show();
}
@Override
public void onConnectionState() { // 接続
Logger.d(TAG, "onConnectionState");
putUserPref(UserPrefKey.BLUETOOTH_DEVICE_TEMPERATURE_CONNECTED, 1);
ABVToastUtil.showMakeText(getApplicationContext(),
String.format(getString(R.string.msg_connected_bluetooth), getString(R.string.set_pairing_central_thermometer)),
Toast.LENGTH_SHORT);
}
@Override
public void onDisConnectionState() { // 切断
Logger.d(TAG, "onDisConnectionState");
putUserPref(UserPrefKey.BLUETOOTH_DEVICE_TEMPERATURE_CONNECTED, 0);
ABVToastUtil.showMakeText(getApplicationContext(), getString(R.string.msg_ble_not_connect), Toast.LENGTH_SHORT);
setThermometerData("");
}
@Override
public void onGetDeviceInfo(String strTemp) { // 機器のデータ
Logger.d(TAG, "onGetDeviceInfo");
Toast.makeText( getApplicationContext(), strTemp, Toast.LENGTH_SHORT ).show();
Logger.d(TAG, "get temperature [%s]", strTemp);
setThermometerData(strTemp);
bleManagerUtil.disconnect();
}
@Override
public void onGetDeviceInfoFailed() { // 機器のエラー
Logger.d(TAG, "onGetDeviceInfoFailed");
putUserPref(UserPrefKey.BLUETOOTH_DEVICE_TEMPERATURE_CONNECTED, 0);
ABookAlertDialog alert = AlertDialogUtil.createAlertDialog(ABVContentViewActivity.this, R.string.set_pairing_central_thermometer);
alert.setMessage(String.format(getString(R.string.msg_ble_connect_error), getString(R.string.set_pairing_central_thermometer), getString(R.string.set_pairing_central_thermometer)));
alert.setButton(DialogInterface.BUTTON_POSITIVE, getString(R.string.ok), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
setThermometerData("");
bleManagerUtil.disconnect();
}
});
alert.show();
}
});
bleManagerUtil.startDeviceInfo();
} }
private void showUpdateContentAlert(long contentId) { private void showUpdateContentAlert(long contentId) {
...@@ -381,15 +302,6 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity { ...@@ -381,15 +302,6 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
if (!getRBoolean(R.bool.use_cache) && objectId == -1) { if (!getRBoolean(R.bool.use_cache) && objectId == -1) {
ContentFileExtractor.getInstance().removeContentCash(contentId); ContentFileExtractor.getInstance().removeContentCash(contentId);
} }
// 接続されている機器と切断する。
if( null != bleManagerUtil.mBluetoothGatt )
{
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
bleManagerUtil.mBluetoothGatt.disconnect();
}
putUserPref(UserPrefKey.BLUETOOTH_DEVICE_TEMPERATURE_CONNECTED, 0);
}
} }
public long getContentId() { public long getContentId() {
...@@ -1084,9 +996,6 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity { ...@@ -1084,9 +996,6 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
if(isOperationPdf) { if(isOperationPdf) {
onActionOperationPdfWebView(abookCheckParam, operationTaskDto); onActionOperationPdfWebView(abookCheckParam, operationTaskDto);
} }
if (Constant.XWalkWebViewDisplayStatus.TaskView != mStatusCode) {
bleManagerUtil.disconnect();
}
} else if (mCmd.equals(ABookKeys.CMD_SAVE_ATTACHED)) { } else if (mCmd.equals(ABookKeys.CMD_SAVE_ATTACHED)) {
mAttachedFileName = abookCheckParam.get(ABookKeys.FILE_NAME); mAttachedFileName = abookCheckParam.get(ABookKeys.FILE_NAME);
getAttachedDataUrl(); getAttachedDataUrl();
...@@ -1159,28 +1068,11 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity { ...@@ -1159,28 +1068,11 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
Logger.e(TAG, "startContentActivity failed.", e); Logger.e(TAG, "startContentActivity failed.", e);
ErrorMessage.showErrorMessageToast(getApplicationContext(), ErrorCode.E107); ErrorMessage.showErrorMessageToast(getApplicationContext(), ErrorCode.E107);
} }
} } else if (mCmd.equals(ABookKeys.CMD_GET_DEVICE_INFO)) {
// ビーコンデータを受信して目的のデバイスIDの信号から値を取得する // ビーコンデータを受信して目的のデバイスIDの信号から値を取得する
// 1:芯温系 2:置くだけセンサー 3:バーコード // 1:中心温度計 2:置くだけセンサー 3:バーコード
else if (mCmd.equals(ABookKeys.CMD_GET_DEVICE_INFO)) { getDeviceInfo(abookCheckParam);
int device_type = 0;
if (abookCheckParam.containsKey(ABookKeys.TASK_DEVICE_TYPE)) {
device_type = Integer.valueOf(abookCheckParam.get(ABookKeys.TASK_DEVICE_TYPE)); // ディバイスのタイプ取得
mQid = abookCheckParam.get(ABookKeys.TASK_QUESTION_ID); // 設問ID取得
// 1:芯温系 2:置くだけセンサー 3:バーコード
if (device_type == Constant.DeviceType.thermomete) { // 芯温系
setThermometerDeviceInfo((Integer.valueOf(abookCheckParam.get(ABookKeys.TASK_DEVICE_TYPE)) == Constant.DeviceType.thermomete));
} else if (device_type == Constant.DeviceType.sensor) { // 置くだけセンサー
ErrorMessage.showErrorMessageToast(getApplicationContext(), "Not ready !!!!"); // set Error Message
} else if (device_type == Constant.DeviceType.barcode) { // バーコード
setBarcodeDeviceInfo();
} else {
ErrorMessage.showErrorMessageToast(getApplicationContext(), "Device is not working"); // set Error Message
}
} else {
ErrorMessage.showErrorMessageToast(getApplicationContext(), "Device is not working"); // set Error Message
}
} }
} }
...@@ -1420,129 +1312,6 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity { ...@@ -1420,129 +1312,6 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
} }
} }
/** //ABVCheckContentViewActivityから処理
* ディバイスのバーコードの情報取得 protected void getDeviceInfo(Map<String, String> abookCheckParam) {}
*/
protected void setBarcodeDeviceInfo() {
//カメラパーミッションチェック
ABookPermissionHelper helper = new ABookPermissionHelper(this, Constant.ABookPermissionType.Camera, null);
if (!helper.checkMultiPermissions(true)) {
Logger.w(TAG,"startCameraIntent Camera Permission false");
return;
}
Intent barcodeactivityIntent = new Intent( this, BarCodeReaderActivity.class );
startActivityForResult( barcodeactivityIntent, REQUEST_BARCODE_READER );
}
/**
* BLEディバイスの芯温系の情報取得
* @param showPermissionDialogFlg
*/
protected void setThermometerDeviceInfo(final boolean showPermissionDialogFlg) {
ABookPermissionHelper helper = new ABookPermissionHelper(this, Constant.ABookPermissionType.Bluetooth, null);
if (helper.checkMultiPermissions(showPermissionDialogFlg)) {
String deviceAddress = getUserPref(UserPrefKey.BLUETOOTH_DEVICE_TEMPERATURE_ADDRESS, "");
if (deviceAddress.length() > 0) {
// Android端末のBluetooth機能の有効化要求
requestBluetoothFeature();
bleManagerUtil.mDeviceAddress = deviceAddress;
// 接続
bleManagerUtil.connect();
} else {
ABookAlertDialog alert = AlertDialogUtil.createAlertDialog(ABVContentViewActivity.this, R.string.set_pairing_central_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("");
}
});
alert.show();
}
} else {
Logger.w(TAG,"onGetDeviceInfoFailed Connect BLE Device false");
// リソースパターンの適用
afterABookCheckApi(mCmd, "", 1, PatternStringUtil.patternToString(getApplicationContext(),
R.string.msg_location_search_fail,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)), null);
}
}
// Android端末のBluetooth機能の有効化要求
public void requestBluetoothFeature() {
if( bleManagerUtil.mBluetoothAdapter.isEnabled() ) {
return;
}
// デバイスのBluetooth機能が有効になっていないときは、有効化要求(ダイアログ表示)
Intent enableBtIntent = new Intent( BluetoothAdapter.ACTION_REQUEST_ENABLE );
startActivityForResult( enableBtIntent, REQUEST_ENABLEBLUETOOTH );
}
// 機能の有効化Activityの操作結果
@Override
protected void onActivityResult( int requestCode, int resultCode, Intent data ) {
switch( requestCode ) {
case REQUEST_ENABLEBLUETOOTH: // Bluetooth有効化要求
if( Activity.RESULT_CANCELED == resultCode ) { // 有効にされなかった
ABVToastUtil.showMakeText(getApplicationContext(), getString(R.string.bluetooth_is_not_working), Toast.LENGTH_SHORT);
return;
}
break;
case REQUEST_CONNECTDEVICE: // デバイス接続要求
String strDeviceName;
if( Activity.RESULT_OK == resultCode ) {
// デバイスリストアクティビティからの情報の取得
bleManagerUtil.mDeviceAddress = mDeviceAddress;
strDeviceName = data.getStringExtra( PairingSettingActivity.EXTRAS_DEVICE_NAME );
bleManagerUtil.mDeviceAddress = data.getStringExtra( PairingSettingActivity.EXTRAS_DEVICE_ADDRESS );
// 取得したデバイスリストアクティビティからの情報をローカルに保存
setUserPref(strDeviceName, bleManagerUtil.mDeviceAddress, 1);
} else {
strDeviceName = "";
bleManagerUtil.mDeviceAddress = "";
setUserPref(strDeviceName, bleManagerUtil.mDeviceAddress, 0);
}
break;
case REQUEST_BARCODE_READER: // バーコードの要求
setBarCodeData(data.getStringExtra(BarCodeReaderActivity.BARCODE_READING_DATA)); // バーコードの読み取りデータ
break;
}
super.onActivityResult( requestCode, resultCode, data );
}
// // 機器連携の設定画面を表示する。
// public void setPairingSetting() {
// Intent devicelistactivityIntent = new Intent( this, PairingSettingActivity.class );
// startActivityForResult( devicelistactivityIntent, REQUEST_CONNECTDEVICE );
// }
// 機器連携の情報をローカルに保存する。
public void setUserPref(String deviceName, String deviceAddress, int deviceUsed) {
putUserPref(UserPrefKey.BLUETOOTH_DEVICE_TEMPERATURE_NAME, deviceName);
putUserPref(UserPrefKey.BLUETOOTH_DEVICE_TEMPERATURE_ADDRESS, deviceAddress);
putUserPref(UserPrefKey.BLUETOOTH_DEVICE_TEMPERATURE_CONNECTED, deviceUsed);
}
// CMS側にバーコードリーダーから読み取ったデータを転送する。
protected void setBarCodeData(String barcodeData) {
Logger.v(TAG, "barcode [%s]", barcodeData);
JSONObject barcodeJson = new JSONObject();
barcodeJson.put(ABookKeys.TASK_QUESTION_ID, mQid);
barcodeJson.put("value", barcodeData);
afterABookCheckApi(mCmd, "", 0, "", barcodeJson.toString());
Toast.makeText( getApplicationContext(), barcodeData, Toast.LENGTH_SHORT ).show();
Logger.v(TAG, "barcode JSON [%s]", barcodeJson.toString());
}
// CMS側に芯温計からのデータを転送する。
protected void setThermometerData(String strTemp) {
Logger.v(TAG, "thermometer [%s]", strTemp);
JSONObject thermometerDataJson = new JSONObject();
thermometerDataJson.put(ABookKeys.TASK_QUESTION_ID, mQid);
thermometerDataJson.put("value", strTemp);
afterABookCheckApi(mCmd, "", 0, "", thermometerDataJson.toString());
Logger.v(TAG, "thermometer JSON [%s]", thermometerDataJson.toString());
}
} }
...@@ -59,7 +59,6 @@ public interface AppDefType { ...@@ -59,7 +59,6 @@ public interface AppDefType {
String BLUETOOTH_DEVICE_TEMPERATURE_NAME = "bleDeviceTemperatureName"; // 温度計機器の名 String BLUETOOTH_DEVICE_TEMPERATURE_NAME = "bleDeviceTemperatureName"; // 温度計機器の名
String BLUETOOTH_DEVICE_TEMPERATURE_ADDRESS = "bleDeviceTemperatureAddress"; // 温度計機器のアドレス String BLUETOOTH_DEVICE_TEMPERATURE_ADDRESS = "bleDeviceTemperatureAddress"; // 温度計機器のアドレス
String BLUETOOTH_DEVICE_TEMPERATURE_CONNECTED = "bleDeviceTemperatureConnected"; // 芯温計機器と接続可否
String MASTER_DATA_FETCH_DATE = "masterDataFetchDate"; // マスタデータのFetchDate String MASTER_DATA_FETCH_DATE = "masterDataFetchDate"; // マスタデータのFetchDate
} }
......
package jp.agentec.abook.abv.ui.home.activity; package jp.agentec.abook.abv.ui.home.activity;
import android.app.Activity;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.EditText;
import com.honeywell.barcode.HSMDecodeComponent; import com.honeywell.barcode.HSMDecodeComponent;
import com.honeywell.barcode.HSMDecodeResult; import com.honeywell.barcode.HSMDecodeResult;
import com.honeywell.barcode.HSMDecoder; import com.honeywell.barcode.HSMDecoder;
import com.honeywell.barcode.Symbology; import com.honeywell.barcode.Symbology;
import com.honeywell.license.ActivationManager; import com.honeywell.license.ActivationManager;
import com.honeywell.license.ActivationResult; import com.honeywell.license.ActivationResult;
import com.honeywell.plugins.PluginResultListener;
import com.honeywell.plugins.decode.DecodeResultListener; import com.honeywell.plugins.decode.DecodeResultListener;
import jp.agentec.abook.abv.bl.common.log.Logger; import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.launcher.android.R; import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.activity.ABVUIActivity;
import jp.agentec.abook.abv.ui.common.dialog.ABookAlertDialog; import jp.agentec.abook.abv.ui.common.dialog.ABookAlertDialog;
import jp.agentec.abook.abv.ui.common.util.AlertDialogUtil; import jp.agentec.abook.abv.ui.common.util.AlertDialogUtil;
import jp.agentec.abook.abv.ui.home.plugin.BarCodeReaderCustomPlugin;
import android.app.Activity;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import jp.agentec.abook.abv.ui.home.plugin.BarCodeReaderCustomPluginResultListener; import jp.agentec.abook.abv.ui.home.plugin.BarCodeReaderCustomPluginResultListener;
/* The purpose of this sample code is to show the multiple different ways you can use bar code scanning functionality in your application. /* The purpose of this sample code is to show the multiple different ways you can use bar code scanning functionality in your application.
...@@ -43,7 +33,7 @@ import jp.agentec.abook.abv.ui.home.plugin.BarCodeReaderCustomPluginResultListen ...@@ -43,7 +33,7 @@ import jp.agentec.abook.abv.ui.home.plugin.BarCodeReaderCustomPluginResultListen
* 3) You can create a custom SwiftPlugin to completely control the look and operation of a scan event. * 3) You can create a custom SwiftPlugin to completely control the look and operation of a scan event.
* This custom plug-in must be registered with HSMDecoder and can be used with either method 1 or 2 mentioned above. * This custom plug-in must be registered with HSMDecoder and can be used with either method 1 or 2 mentioned above.
*/ */
public class BarCodeReaderActivity extends Activity implements DecodeResultListener, BarCodeReaderCustomPluginResultListener { public class BarCodeReaderActivity extends ABVUIActivity implements DecodeResultListener, BarCodeReaderCustomPluginResultListener {
public HSMDecoder hsmDecoder; public HSMDecoder hsmDecoder;
private EditText editTextDisplay; private EditText editTextDisplay;
...@@ -62,12 +52,10 @@ public class BarCodeReaderActivity extends Activity implements DecodeResultListe ...@@ -62,12 +52,10 @@ public class BarCodeReaderActivity extends Activity implements DecodeResultListe
//activate the API with your license key //activate the API with your license key
ActivationResult activationResult = ActivationManager.activate(this, "trial-image-areyn-12062017"); ActivationResult activationResult = ActivationManager.activate(this, "trial-image-areyn-12062017");
Toast.makeText(this, "Activation Result: " + activationResult, Toast.LENGTH_LONG).show();
//get the singleton instance of the decoder //get the singleton instance of the decoder
hsmDecoder = HSMDecoder.getInstance(this); hsmDecoder = HSMDecoder.getInstance(this);
Logger.d(TAG, "isDecodingEnabled !!!! [ " + hsmDecoder.isDecodingEnabled()); Logger.d(TAG, "isDecodingEnabled !!!! [ " + hsmDecoder.isDecodingEnabled());
// Toast.makeText(this, "Activation isDecodingEnabled: " + hsmDecoder.isDecodingEnabled(), Toast.LENGTH_LONG).show();
//set all decoder related settings //set all decoder related settings
setSymbology(); setSymbology();
...@@ -112,7 +100,7 @@ public class BarCodeReaderActivity extends Activity implements DecodeResultListe ...@@ -112,7 +100,7 @@ public class BarCodeReaderActivity extends Activity implements DecodeResultListe
} }
private void displayBarcodeData(HSMDecodeResult[] barcodeData) { private void displayBarcodeData(HSMDecodeResult[] barcodeData) {
Toast.makeText(this, "barcodeData.length : [%d]" + barcodeData.length, Toast.LENGTH_LONG).show(); // Toast.makeText(this, "barcodeData.length : [%d]" + barcodeData.length, Toast.LENGTH_LONG).show();
if( barcodeData.length > 0) { if( barcodeData.length > 0) {
HSMDecodeResult firstResult = barcodeData[0]; HSMDecodeResult firstResult = barcodeData[0];
...@@ -126,12 +114,12 @@ public class BarCodeReaderActivity extends Activity implements DecodeResultListe ...@@ -126,12 +114,12 @@ public class BarCodeReaderActivity extends Activity implements DecodeResultListe
if (scanCount == 1) { if (scanCount == 1) {
hsmDecoder.enableSound(false); hsmDecoder.enableSound(false);
editTextDisplay.setText(msg); editTextDisplay.setText(msg);
Toast.makeText(this, "Activation Result: " + msg, Toast.LENGTH_LONG).show(); // Toast.makeText(this, "Activation Result: " + msg, Toast.LENGTH_LONG).show();
final String readingBarcodeData = firstResult.getBarcodeData(); final String readingBarcodeData = firstResult.getBarcodeData();
ABookAlertDialog saveDialog = AlertDialogUtil.createAlertDialog(this, getString(R.string.barcode)); ABookAlertDialog saveDialog = AlertDialogUtil.createAlertDialog(this, getString(R.string.barcode));
saveDialog.setMessage(readingBarcodeData); saveDialog.setMessage(readingBarcodeData);
saveDialog.setButton(DialogInterface.BUTTON_POSITIVE, getResources().getString(R.string.confirm), new DialogInterface.OnClickListener() { saveDialog.setButton(DialogInterface.BUTTON_POSITIVE, getResources().getString(R.string.ok), new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
onDisposeInstance(); onDisposeInstance();
...@@ -232,6 +220,7 @@ public class BarCodeReaderActivity extends Activity implements DecodeResultListe ...@@ -232,6 +220,7 @@ public class BarCodeReaderActivity extends Activity implements DecodeResultListe
// 閉じるボタンの処理 // 閉じるボタンの処理
public void onClickCloseView(View v) { public void onClickCloseView(View v) {
onDisposeInstance(); onDisposeInstance();
finish(); finish();
} }
} }
\ No newline at end of file
...@@ -2,7 +2,6 @@ package jp.agentec.abook.abv.ui.home.activity; ...@@ -2,7 +2,6 @@ package jp.agentec.abook.abv.ui.home.activity;
import android.app.DatePickerDialog; import android.app.DatePickerDialog;
import android.app.Dialog; import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.res.Configuration; import android.content.res.Configuration;
...@@ -12,7 +11,6 @@ import android.graphics.BitmapFactory; ...@@ -12,7 +11,6 @@ import android.graphics.BitmapFactory;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.provider.MediaStore; import android.provider.MediaStore;
import android.speech.tts.TextToSpeech;
import android.util.SparseBooleanArray; import android.util.SparseBooleanArray;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.View; import android.view.View;
...@@ -63,9 +61,9 @@ import jp.agentec.abook.abv.bl.common.ABVEnvironment; ...@@ -63,9 +61,9 @@ import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.Callback; import jp.agentec.abook.abv.bl.common.Callback;
import jp.agentec.abook.abv.bl.common.CommonExecutor; import jp.agentec.abook.abv.bl.common.CommonExecutor;
import jp.agentec.abook.abv.bl.common.Constant; import jp.agentec.abook.abv.bl.common.Constant;
import jp.agentec.abook.abv.bl.common.Constant.PushMessageSendType;
import jp.agentec.abook.abv.bl.common.Constant.ReportType; import jp.agentec.abook.abv.bl.common.Constant.ReportType;
import jp.agentec.abook.abv.bl.common.Constant.TaskReportLevel; import jp.agentec.abook.abv.bl.common.Constant.TaskReportLevel;
import jp.agentec.abook.abv.bl.common.Constant.PushMessageSendType;
import jp.agentec.abook.abv.bl.common.constant.ABookKeys; import jp.agentec.abook.abv.bl.common.constant.ABookKeys;
import jp.agentec.abook.abv.bl.common.exception.ABVException; import jp.agentec.abook.abv.bl.common.exception.ABVException;
import jp.agentec.abook.abv.bl.common.exception.ABVExceptionCode; import jp.agentec.abook.abv.bl.common.exception.ABVExceptionCode;
...@@ -89,7 +87,6 @@ import jp.agentec.abook.abv.bl.dto.TaskReportDto; ...@@ -89,7 +87,6 @@ import jp.agentec.abook.abv.bl.dto.TaskReportDto;
import jp.agentec.abook.abv.bl.logic.AbstractLogic; import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.OperationLogic; import jp.agentec.abook.abv.bl.logic.OperationLogic;
import jp.agentec.abook.abv.bl.logic.PushMessageLogic; import jp.agentec.abook.abv.bl.logic.PushMessageLogic;
import jp.agentec.abook.abv.cl.util.AndroidStringUtil;
import jp.agentec.abook.abv.cl.util.PreferenceUtil; import jp.agentec.abook.abv.cl.util.PreferenceUtil;
import jp.agentec.abook.abv.launcher.android.R; import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.activity.ABVUIActivity; import jp.agentec.abook.abv.ui.common.activity.ABVUIActivity;
...@@ -115,8 +112,6 @@ import jp.agentec.adf.util.DateTimeUtil; ...@@ -115,8 +112,6 @@ import jp.agentec.adf.util.DateTimeUtil;
import jp.agentec.adf.util.FileUtil; import jp.agentec.adf.util.FileUtil;
import jp.agentec.adf.util.StringUtil; import jp.agentec.adf.util.StringUtil;
import static jp.agentec.abook.abv.cl.util.PreferenceUtil.getUserPref;
/** /**
* Created by leej on 2018/08/17 * Created by leej on 2018/08/17
*/ */
...@@ -436,9 +431,6 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -436,9 +431,6 @@ public class OperationListActivity extends ABVUIActivity {
}); });
} }
// masterDataの fetchDateの取得する。
ABVEnvironment.getInstance().tempMasterDataFetchDate = getUserPref(AppDefType.UserPrefKey.MASTER_DATA_FETCH_DATE, "");
if (!activityResultFlg && operationId == -1) { if (!activityResultFlg && operationId == -1) {
dataRefresh(true); dataRefresh(true);
} }
...@@ -1784,9 +1776,6 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -1784,9 +1776,6 @@ public class OperationListActivity extends ABVUIActivity {
} }
} }
// masterDataの fetchDateの取得する。
ABVEnvironment.getInstance().tempMasterDataFetchDate = getUserPref(AppDefType.UserPrefKey.MASTER_DATA_FETCH_DATE, "");
CommonExecutor.execute(new Runnable() { CommonExecutor.execute(new Runnable() {
@Override @Override
public void run() { public void run() {
...@@ -1923,7 +1912,7 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -1923,7 +1912,7 @@ public class OperationListActivity extends ABVUIActivity {
} }
private void setMasterDataFetchDate() { private void setMasterDataFetchDate() {
Logger.d(TAG, "ABVEnvironment.getInstance().tempMasterDataFetchDate : " + ABVEnvironment.getInstance().tempMasterDataFetchDate); Logger.d(TAG, "ABVDataCache.getInstance().tempMasterDataFetchDate : " + ABVDataCache.getInstance().tempMasterDataFetchDate);
putUserPref(AppDefType.UserPrefKey.MASTER_DATA_FETCH_DATE, ABVEnvironment.getInstance().tempMasterDataFetchDate); putUserPref(AppDefType.UserPrefKey.MASTER_DATA_FETCH_DATE, ABVDataCache.getInstance().tempMasterDataFetchDate);
} }
} }
...@@ -3,43 +3,28 @@ package jp.agentec.abook.abv.ui.home.activity; ...@@ -3,43 +3,28 @@ package jp.agentec.abook.abv.ui.home.activity;
import android.app.Activity; import android.app.Activity;
import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothManager;
import android.bluetooth.le.BluetoothLeScanner; import android.bluetooth.le.BluetoothLeScanner;
import android.bluetooth.le.ScanCallback; import android.bluetooth.le.ScanCallback;
import android.bluetooth.le.ScanResult; import android.bluetooth.le.ScanResult;
import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.Button; import android.widget.Button;
import android.widget.ImageView;
import android.widget.ListView; import android.widget.ListView;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import org.json.JSONArray;
import org.json.adf.JSONObject;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import jp.agentec.abook.abv.bl.common.log.Logger; import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.cl.util.BleManagerUtil; import jp.agentec.abook.abv.cl.util.BleManagerUtil;
import jp.agentec.abook.abv.cl.util.PreferenceUtil; import jp.agentec.abook.abv.cl.util.PreferenceUtil;
import jp.agentec.abook.abv.launcher.android.R; import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.activity.ABVContentViewActivity;
import jp.agentec.abook.abv.ui.common.activity.ABVNoAuthenticatedActivity;
import jp.agentec.abook.abv.ui.common.activity.ABVUIActivity; import jp.agentec.abook.abv.ui.common.activity.ABVUIActivity;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType; import jp.agentec.abook.abv.ui.common.appinfo.AppDefType;
import jp.agentec.abook.abv.ui.common.dialog.ABookAlertDialog; import jp.agentec.abook.abv.ui.common.dialog.ABookAlertDialog;
...@@ -48,7 +33,6 @@ import jp.agentec.abook.abv.ui.common.util.AlertDialogUtil; ...@@ -48,7 +33,6 @@ import jp.agentec.abook.abv.ui.common.util.AlertDialogUtil;
import jp.agentec.abook.abv.ui.home.adapter.BleListAdapter; import jp.agentec.abook.abv.ui.home.adapter.BleListAdapter;
import jp.agentec.abook.abv.ui.home.adapter.BleListRowData; import jp.agentec.abook.abv.ui.home.adapter.BleListRowData;
import jp.agentec.abook.abv.ui.home.adapter.common.SectionHeaderData; import jp.agentec.abook.abv.ui.home.adapter.common.SectionHeaderData;
import jp.agentec.abook.abv.ui.home.adapter.common.SectionRowData;
public class PairingSettingActivity extends ABVUIActivity { public class PairingSettingActivity extends ABVUIActivity {
private static final String TAG = "PairingSettingActivity"; private static final String TAG = "PairingSettingActivity";
...@@ -122,9 +106,6 @@ public class PairingSettingActivity extends ABVUIActivity { ...@@ -122,9 +106,6 @@ public class PairingSettingActivity extends ABVUIActivity {
TextView deviceTitle = (TextView) findViewById(R.id.device_toolbar_title); TextView deviceTitle = (TextView) findViewById(R.id.device_toolbar_title);
deviceTitle.setText(R.string.set_pairing_central_thermometer); deviceTitle.setText(R.string.set_pairing_central_thermometer);
//初期値(未接続状態)
putUserPref(AppDefType.UserPrefKey.BLUETOOTH_DEVICE_TEMPERATURE_CONNECTED, AppDefType.BlueToothConnectStatus.DISCONNECT);
// 戻り値の初期化 // 戻り値の初期化
setResult( Activity.RESULT_CANCELED ); setResult( Activity.RESULT_CANCELED );
...@@ -140,10 +121,6 @@ public class PairingSettingActivity extends ABVUIActivity { ...@@ -140,10 +121,6 @@ public class PairingSettingActivity extends ABVUIActivity {
if (mConnecting) { //接続中 if (mConnecting) { //接続中
return; return;
} }
int status = getUserPref(AppDefType.UserPrefKey.BLUETOOTH_DEVICE_TEMPERATURE_CONNECTED, 0);
if (status == AppDefType.BlueToothConnectStatus.CONNECT_SUCCESS) { //接続済み
bleManagerUtil.disconnect();
}
removeBleConnectInfoUserPref(); removeBleConnectInfoUserPref();
reloadListView(); reloadListView();
...@@ -153,6 +130,12 @@ public class PairingSettingActivity extends ABVUIActivity { ...@@ -153,6 +130,12 @@ public class PairingSettingActivity extends ABVUIActivity {
} }
} }
}); });
// Bluetoothと接続処理する
bleManagerUtil = new BleManagerUtil(this, null);
bleManagerUtil.startDeviceInfo();
ListView listView = (ListView) findViewById(R.id.devicelist); // リストビューの取得 ListView listView = (ListView) findViewById(R.id.devicelist); // リストビューの取得
listView.setAdapter(mBleListAdapter); // リストビューにビューアダプターをセット listView.setAdapter(mBleListAdapter); // リストビューにビューアダプターをセット
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
...@@ -161,64 +144,9 @@ public class PairingSettingActivity extends ABVUIActivity { ...@@ -161,64 +144,9 @@ public class PairingSettingActivity extends ABVUIActivity {
long id) { long id) {
Logger.d(TAG, "position = " + position); Logger.d(TAG, "position = " + position);
BleListRowData bleListRowData = (BleListRowData)parent.getItemAtPosition(position); BleListRowData bleListRowData = (BleListRowData)parent.getItemAtPosition(position);
connectDevice(bleListRowData); localSaveDeviceInfo(bleListRowData);
}
});
// Bluetoothと接続処理する
bleManagerUtil = new BleManagerUtil(this, new BleManagerUtil.BleManagerUtilListener() {
@Override
public void onConnectionError() { //接続失敗
Logger.d(TAG, "onConnectionError");
if (mSavedDeviceAddress != null) {
setUserPref(bleManagerUtil.mDeviceName, bleManagerUtil.mDeviceAddress, AppDefType.BlueToothConnectStatus.CONNECT_FAIL);
}
//画面リロード
reloadListView();
mConnecting = false;
}
@Override
public void onConnectionState() { // 接続
Logger.d(TAG, "onConnectionState");
// ローカルにディバイスの情報を保存する。
setUserPref(bleManagerUtil.mDeviceName, bleManagerUtil.mDeviceAddress, AppDefType.BlueToothConnectStatus.CONNECT_SUCCESS);
//スキャン情報から削除
BluetoothDevice deleteDevice = null;
for (BluetoothDevice device : mScanDeviceInfoList) {
if (device.getAddress().equals(bleManagerUtil.mDeviceAddress)) {
mScanDeviceInfoList.remove(device);
}
}
//画面リロード
reloadListView();
mConnecting = false;
}
@Override
public void onDisConnectionState() { // 切断
Logger.d(TAG, "onDisConnectionState");
putUserPref(AppDefType.UserPrefKey.BLUETOOTH_DEVICE_TEMPERATURE_CONNECTED, AppDefType.BlueToothConnectStatus.DISCONNECT);
reloadListView();
mConnecting = false;
}
@Override
public void onGetDeviceInfo(String strTemp) { // 機器のデータ
Logger.d(TAG, "onGetDeviceInfo");
closeProgressPopup();
Logger.d(TAG, "get temperature [%s]", strTemp);
}
@Override
public void onGetDeviceInfoFailed() { // 機器のエラー
Logger.d(TAG, "onGetDeviceInfoFailed");
closeProgressPopup();
showConfirmAlert( R.string.set_pairing_central_thermometer, String.format(getString(R.string.msg_ble_connect_error), getString(R.string.set_pairing_central_thermometer), getString(R.string.set_pairing_central_thermometer)));
} }
}); });
bleManagerUtil.startDeviceInfo();
// Reload Button // Reload Button
mButton_Scan = (Button)findViewById( R.id.btn_reload ); mButton_Scan = (Button)findViewById( R.id.btn_reload );
...@@ -264,34 +192,14 @@ public class PairingSettingActivity extends ABVUIActivity { ...@@ -264,34 +192,14 @@ public class PairingSettingActivity extends ABVUIActivity {
stopScan(); stopScan();
} }
@Override // 機能の有効化ダイアログの操作結果
protected void onDestroy() {
super.onDestroy();
// Gattサービスがある場合、切断するためnullにする。
if( null != bleManagerUtil.mBluetoothGatt ) {
bleManagerUtil.mBluetoothGatt.disconnect();
putUserPref(AppDefType.UserPrefKey.BLUETOOTH_DEVICE_TEMPERATURE_CONNECTED, 0);
}
}
// デバイスのBluetooth機能の有効化要求
private void requestBluetoothFeature() {
if( bleManagerUtil.mBluetoothAdapter.isEnabled() ) {
return;
}
// デバイスのBluetooth機能が有効になっていないときは、有効化要求(ダイアログ表示)
Intent enableBtIntent = new Intent( BluetoothAdapter.ACTION_REQUEST_ENABLE );
startActivityForResult( enableBtIntent, REQUEST_ENABLEBLUETOOTH );
}
// 機能の有効化ダイアログの操作結果 // 機能の有効化ダイアログの操作結果
@Override @Override
protected void onActivityResult( int requestCode, int resultCode, Intent data ) { protected void onActivityResult( int requestCode, int resultCode, Intent data ) {
switch( requestCode ) { switch (requestCode) {
case REQUEST_ENABLEBLUETOOTH: // Bluetooth有効化要求 case REQUEST_ENABLEBLUETOOTH: // Bluetooth有効化要求
if( Activity.RESULT_CANCELED == resultCode ) { // 有効にされなかった if( Activity.RESULT_CANCELED == resultCode ) { // 有効にされなかった
ABVToastUtil.showMakeText(getApplicationContext(), getString(R.string.bluetooth_is_not_working), Toast.LENGTH_SHORT); ABVToastUtil.showMakeText(getApplicationContext(), getString(R.string.msg_scan_bluetooth_no_allow), Toast.LENGTH_SHORT);
return; return;
} }
break; break;
...@@ -327,7 +235,7 @@ public class PairingSettingActivity extends ABVUIActivity { ...@@ -327,7 +235,7 @@ public class PairingSettingActivity extends ABVUIActivity {
mScanning = true; mScanning = true;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
scanner.startScan( mLeScanCallback ); scanner.startScan(mLeScanCallback);
} }
mButton_Scan.setText(getString(R.string.pairing_search_stop)); mButton_Scan.setText(getString(R.string.pairing_search_stop));
reloadListView(); reloadListView();
...@@ -357,61 +265,30 @@ public class PairingSettingActivity extends ABVUIActivity { ...@@ -357,61 +265,30 @@ public class PairingSettingActivity extends ABVUIActivity {
Logger.d(TAG, "stop scan !!"); Logger.d(TAG, "stop scan !!");
} }
private void connectDevice(BleListRowData bleListRowData) { private void localSaveDeviceInfo(BleListRowData bleListRowData) {
String savedDeviceAddress = getUserPref(AppDefType.UserPrefKey.BLUETOOTH_DEVICE_TEMPERATURE_ADDRESS, "");
//スキャン中の場合、中止する。 if (!savedDeviceAddress.equals(bleListRowData.deviceAddress)) { //保存している
if (mScanning) { mSavedDeviceAddress = bleListRowData.deviceAddress;
stopScan(); setUserPref(bleListRowData.title, mSavedDeviceAddress);
} for (BluetoothDevice savedScanDevice : mScanDeviceInfoList) {
if (savedScanDevice.getAddress().equals(mSavedDeviceAddress)) {
//2重接続防止 mScanDeviceInfoList.remove(savedScanDevice);
if (mConnecting) {
return;
}
//登録されたデバイス情報を選択した場合
if (bleListRowData.isSaved) {
//接続済み状態の場合、接続を切る
if (bleListRowData.subTitle.equals(getString(R.string.ble_connect_success))) {
bleManagerUtil.disconnect();
return;
} }
} }
mConnecting = true;
String deviceName = bleListRowData.title;
String deviceAddress = bleListRowData.deviceAddress;
bleManagerUtil.mDeviceAddress = deviceAddress;
bleManagerUtil.mDeviceName = deviceName;
// デバイスのBluetooth機能の有効化要求
requestBluetoothFeature();
// 接続
bleManagerUtil.connect();
if (mSavedDeviceAddress != null) {
setUserPref(bleManagerUtil.mDeviceName, bleManagerUtil.mDeviceAddress, AppDefType.BlueToothConnectStatus.CONNECTING);
//画面リロード //画面リロード
reloadListView(); reloadListView();
} }
} }
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();
} }
// 機器連携の情報をローカルに保存する。 // 機器連携の情報をローカルに保存する。
public void setUserPref(String deviceName, String deviceAddress, int deviceConnected) { public void setUserPref(String deviceName, String deviceAddress) {
putUserPref(AppDefType.UserPrefKey.BLUETOOTH_DEVICE_TEMPERATURE_NAME, deviceName); putUserPref(AppDefType.UserPrefKey.BLUETOOTH_DEVICE_TEMPERATURE_NAME, deviceName);
putUserPref(AppDefType.UserPrefKey.BLUETOOTH_DEVICE_TEMPERATURE_ADDRESS, deviceAddress); putUserPref(AppDefType.UserPrefKey.BLUETOOTH_DEVICE_TEMPERATURE_ADDRESS, deviceAddress);
putUserPref(AppDefType.UserPrefKey.BLUETOOTH_DEVICE_TEMPERATURE_CONNECTED, deviceConnected);
} }
/** /**
...@@ -420,7 +297,6 @@ public class PairingSettingActivity extends ABVUIActivity { ...@@ -420,7 +297,6 @@ public class PairingSettingActivity extends ABVUIActivity {
private void removeBleConnectInfoUserPref() { private void removeBleConnectInfoUserPref() {
PreferenceUtil.removeUserPref(this, AppDefType.UserPrefKey.BLUETOOTH_DEVICE_TEMPERATURE_NAME); PreferenceUtil.removeUserPref(this, AppDefType.UserPrefKey.BLUETOOTH_DEVICE_TEMPERATURE_NAME);
PreferenceUtil.removeUserPref(this, AppDefType.UserPrefKey.BLUETOOTH_DEVICE_TEMPERATURE_ADDRESS); PreferenceUtil.removeUserPref(this, AppDefType.UserPrefKey.BLUETOOTH_DEVICE_TEMPERATURE_ADDRESS);
PreferenceUtil.removeUserPref(this, AppDefType.UserPrefKey.BLUETOOTH_DEVICE_TEMPERATURE_CONNECTED);
mSavedDeviceAddress = null; mSavedDeviceAddress = null;
} }
...@@ -460,30 +336,7 @@ public class PairingSettingActivity extends ABVUIActivity { ...@@ -460,30 +336,7 @@ public class PairingSettingActivity extends ABVUIActivity {
String deviceName = getUserPref(AppDefType.UserPrefKey.BLUETOOTH_DEVICE_TEMPERATURE_NAME, ""); String deviceName = getUserPref(AppDefType.UserPrefKey.BLUETOOTH_DEVICE_TEMPERATURE_NAME, "");
String deviceAddress = getUserPref(AppDefType.UserPrefKey.BLUETOOTH_DEVICE_TEMPERATURE_ADDRESS, ""); String deviceAddress = getUserPref(AppDefType.UserPrefKey.BLUETOOTH_DEVICE_TEMPERATURE_ADDRESS, "");
int status = getUserPref(AppDefType.UserPrefKey.BLUETOOTH_DEVICE_TEMPERATURE_CONNECTED, 0); BleListRowData rowData = new BleListRowData(deviceName, deviceAddress, true);
String deviceConnectStatus = null;
switch (status) {
case AppDefType.BlueToothConnectStatus.CONNECT_FAIL:
deviceConnectStatus = getString(R.string.ble_connect_fail);
break;
case AppDefType.BlueToothConnectStatus.DISCONNECT:
deviceConnectStatus = getString(R.string.ble_disconnect);
break;
case AppDefType.BlueToothConnectStatus.CONNECTING:
deviceConnectStatus = getString(R.string.ble_connecting);
break;
case AppDefType.BlueToothConnectStatus.CONNECT_SUCCESS:
deviceConnectStatus = getString(R.string.ble_connect_success);
break;
default:
deviceConnectStatus = getString(R.string.ble_disconnect);
break;
}
BleListRowData rowData = new BleListRowData(deviceName, deviceConnectStatus , deviceAddress);
rowDataList.add(rowData); rowDataList.add(rowData);
rowList.add(rowDataList); rowList.add(rowDataList);
...@@ -497,7 +350,7 @@ public class PairingSettingActivity extends ABVUIActivity { ...@@ -497,7 +350,7 @@ public class PairingSettingActivity extends ABVUIActivity {
} else { } else {
List<BleListRowData> scanRowDataList = new ArrayList<BleListRowData>(); List<BleListRowData> scanRowDataList = new ArrayList<BleListRowData>();
for (BluetoothDevice bleDevice : mScanDeviceInfoList) { for (BluetoothDevice bleDevice : mScanDeviceInfoList) {
BleListRowData scanRowData = new BleListRowData(bleDevice.getName() , bleDevice.getAddress()); BleListRowData scanRowData = new BleListRowData(bleDevice.getName() , bleDevice.getAddress(), false);
scanRowDataList.add(scanRowData); scanRowDataList.add(scanRowData);
} }
rowList.add(scanRowDataList); rowList.add(scanRowDataList);
...@@ -513,6 +366,17 @@ public class PairingSettingActivity extends ABVUIActivity { ...@@ -513,6 +366,17 @@ public class PairingSettingActivity extends ABVUIActivity {
List<SectionHeaderData> sectionList = getSectionListInfo(); List<SectionHeaderData> sectionList = getSectionListInfo();
List<List<BleListRowData>> rowList = getRowListInfo(); List<List<BleListRowData>> rowList = getRowListInfo();
mBleListAdapter.setItem(sectionList, rowList); mBleListAdapter.setItem(sectionList, rowList);
}
// デバイスのBluetooth機能の有効化要求
private void requestBluetoothFeature() {
if(bleManagerUtil.mBluetoothAdapter.isEnabled()) {
return;
} }
// デバイスのBluetooth機能が有効になっていないときは、有効化要求(ダイアログ表示)
Intent enableBtIntent = new Intent( BluetoothAdapter.ACTION_REQUEST_ENABLE );
startActivityForResult( enableBtIntent, REQUEST_ENABLEBLUETOOTH );
}
} }
package jp.agentec.abook.abv.ui.home.adapter; package jp.agentec.abook.abv.ui.home.adapter;
import android.content.Context; import android.content.Context;
import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup;
import android.widget.Button; import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import java.util.List; import java.util.List;
import java.util.Map;
import jp.agentec.abook.abv.launcher.android.R; import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.home.adapter.common.BaseSectionAdapter; import jp.agentec.abook.abv.ui.home.adapter.common.BaseSectionAdapter;
import jp.agentec.abook.abv.ui.home.adapter.common.IndexPath; import jp.agentec.abook.abv.ui.home.adapter.common.IndexPath;
import jp.agentec.abook.abv.ui.home.adapter.common.SectionHeaderData; import jp.agentec.abook.abv.ui.home.adapter.common.SectionHeaderData;
import static jp.agentec.abook.abv.ui.home.activity.PairingSettingActivity.DEVICE_CONNECTED;
import static jp.agentec.abook.abv.ui.home.activity.PairingSettingActivity.EXTRAS_DEVICE_ADDRESS;
import static jp.agentec.abook.abv.ui.home.activity.PairingSettingActivity.EXTRAS_DEVICE_NAME;
import static org.chromium.base.ThreadUtils.runOnUiThread;
/** /**
* Created by kim, changgyun on 2018/11/15. * Created by kim, changgyun on 2018/11/15.
*/ */
...@@ -28,13 +19,6 @@ import static org.chromium.base.ThreadUtils.runOnUiThread; ...@@ -28,13 +19,6 @@ import static org.chromium.base.ThreadUtils.runOnUiThread;
public class BleListAdapter extends BaseSectionAdapter<SectionHeaderData, BleListRowData> { public class BleListAdapter extends BaseSectionAdapter<SectionHeaderData, BleListRowData> {
private static final String TAG = "BleListAdapter"; private static final String TAG = "BleListAdapter";
protected BleListAdapter.BleListAdapterListener listener; protected BleListAdapter.BleListAdapterListener listener;
private Context mContext;
private LayoutInflater mInflater;
private List<Map<String, String>> mListItem;
private String savedDeviceAddress = ""; // 保存されているディバイスのアドレス
private String savedDeviceName = ""; // 保存されているディバイスの名
private boolean savedDeviceConnected = false; // 保存されているディバスの接続可否
public interface BleListAdapterListener { public interface BleListAdapterListener {
// 登録されたデバイス情報削除 // 登録されたデバイス情報削除
...@@ -73,7 +57,6 @@ public class BleListAdapter extends BaseSectionAdapter<SectionHeaderData, BleLis ...@@ -73,7 +57,6 @@ public class BleListAdapter extends BaseSectionAdapter<SectionHeaderData, BleLis
convertView = inflater.inflate(R.layout.ble_section_list_row, null); convertView = inflater.inflate(R.layout.ble_section_list_row, null);
holder = new ListRowViewHolder(); holder = new ListRowViewHolder();
holder.bl_title = (TextView) convertView.findViewById(R.id.bl_title); holder.bl_title = (TextView) convertView.findViewById(R.id.bl_title);
holder.bl_subTitle = (TextView) convertView.findViewById(R.id.bl_subTitle);
holder.bl_deleteBtn = (Button) convertView.findViewById(R.id.bl_deleteBtn); holder.bl_deleteBtn = (Button) convertView.findViewById(R.id.bl_deleteBtn);
convertView.setTag(holder); convertView.setTag(holder);
} else { } else {
...@@ -81,12 +64,10 @@ public class BleListAdapter extends BaseSectionAdapter<SectionHeaderData, BleLis ...@@ -81,12 +64,10 @@ public class BleListAdapter extends BaseSectionAdapter<SectionHeaderData, BleLis
} }
BleListRowData rowData = rowList.get(indexPath.section).get(indexPath.row); BleListRowData rowData = rowList.get(indexPath.section).get(indexPath.row);
holder.bl_title.setText(rowData.title); holder.bl_title.setText(rowData.title);
holder.bl_subTitle.setText(rowData.subTitle);
//スキャンされた温度計表示時に削除ボタンと接続ステータス非表示 //スキャンされた温度計表示時に削除ボタンと接続ステータス非表示
if (!rowData.isSaved) { if (!rowData.isSaved) {
holder.bl_deleteBtn.setVisibility(View.INVISIBLE); holder.bl_deleteBtn.setVisibility(View.INVISIBLE);
holder.bl_subTitle.setVisibility(View.GONE);
} else { } else {
holder.bl_deleteBtn.setVisibility(View.VISIBLE); holder.bl_deleteBtn.setVisibility(View.VISIBLE);
holder.bl_deleteBtn.setOnClickListener(new View.OnClickListener() { holder.bl_deleteBtn.setOnClickListener(new View.OnClickListener() {
...@@ -95,7 +76,6 @@ public class BleListAdapter extends BaseSectionAdapter<SectionHeaderData, BleLis ...@@ -95,7 +76,6 @@ public class BleListAdapter extends BaseSectionAdapter<SectionHeaderData, BleLis
listener.onDeleteConnectInfo(); listener.onDeleteConnectInfo();
} }
}); });
holder.bl_subTitle.setVisibility(View.VISIBLE);
} }
return convertView; return convertView;
} }
...@@ -107,7 +87,6 @@ public class BleListAdapter extends BaseSectionAdapter<SectionHeaderData, BleLis ...@@ -107,7 +87,6 @@ public class BleListAdapter extends BaseSectionAdapter<SectionHeaderData, BleLis
static class ListRowViewHolder { static class ListRowViewHolder {
TextView bl_title; TextView bl_title;
TextView bl_subTitle;
Button bl_deleteBtn; Button bl_deleteBtn;
} }
......
...@@ -8,24 +8,23 @@ public class BleListRowData extends SectionRowData { ...@@ -8,24 +8,23 @@ public class BleListRowData extends SectionRowData {
public String deviceAddress; public String deviceAddress;
/** /**
* 中心温度計(登録された温度計) * デフォルト
* @param title 温度計名 * @param title タイトル
* @param deviceAddress デバイスアドレス * @param subTitle サブタイトル
*/ */
public BleListRowData(String title, String deviceAddress) { public BleListRowData(String title, String subTitle) {
super(title, null); super(title, subTitle);
this.deviceAddress = deviceAddress;
this.isSaved = false;
} }
/** /**
* 中心温度計(スキャンされた温度計) * 中心温度計
* @param title 温度計名 * @param title 温度計名
* @param subTitle 接続状態
* @param deviceAddress デバイスアドレス * @param deviceAddress デバイスアドレス
* @param isSaved 登録状態
*/ */
public BleListRowData(String title, String subTitle, String deviceAddress) { public BleListRowData(String title, String deviceAddress, boolean isSaved) {
super(title, subTitle); super(title, null);
this.deviceAddress = deviceAddress; this.deviceAddress = deviceAddress;
this.isSaved = true; this.isSaved = isSaved;
} }
} }
...@@ -26,7 +26,6 @@ import jp.agentec.abook.abv.ui.viewer.activity.HTMLXWalkWebViewActivity; ...@@ -26,7 +26,6 @@ import jp.agentec.abook.abv.ui.viewer.activity.HTMLXWalkWebViewActivity;
import static android.content.pm.PackageManager.PERMISSION_GRANTED; import static android.content.pm.PackageManager.PERMISSION_GRANTED;
import static jp.agentec.abook.abv.cl.util.PreferenceUtil.getUserPref; import static jp.agentec.abook.abv.cl.util.PreferenceUtil.getUserPref;
import static org.chromium.base.ContextUtils.getApplicationContext;
/** /**
* 権限チェック及び設定画面遷移 * 権限チェック及び設定画面遷移
...@@ -105,14 +104,14 @@ public class ABookPermissionHelper { ...@@ -105,14 +104,14 @@ public class ABookPermissionHelper {
ContextCompat.checkSelfPermission(mActivity, android.Manifest.permission.WRITE_EXTERNAL_STORAGE) != PERMISSION_GRANTED) { ContextCompat.checkSelfPermission(mActivity, android.Manifest.permission.WRITE_EXTERNAL_STORAGE) != PERMISSION_GRANTED) {
if (mActivity instanceof HTMLWebViewActivity || mActivity instanceof HTMLXWalkWebViewActivity || mActivity instanceof OperationListActivity) { if (mActivity instanceof HTMLWebViewActivity || mActivity instanceof HTMLXWalkWebViewActivity || mActivity instanceof OperationListActivity) {
// リソースパターンの適用 // リソースパターンの適用
permitionTextResourceId = PatternStringUtil.patternToInt(getApplicationContext(), permitionTextResourceId = PatternStringUtil.patternToInt(mActivity.getApplicationContext(),
R.string.msg_permission_dialog_storage_album, R.string.msg_permission_dialog_storage_album,
getUserPref(getApplicationContext(), AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)); getUserPref(mActivity.getApplicationContext(), AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0));
} else { } else {
// リソースパターンの適用 // リソースパターンの適用
permitionTextResourceId = PatternStringUtil.patternToInt(getApplicationContext(), permitionTextResourceId = PatternStringUtil.patternToInt(mActivity.getApplicationContext(),
R.string.msg_permission_dialog_storage_update, R.string.msg_permission_dialog_storage_update,
getUserPref(getApplicationContext(), AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)); getUserPref(mActivity.getApplicationContext(), AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0));
} }
} }
...@@ -122,16 +121,16 @@ public class ABookPermissionHelper { ...@@ -122,16 +121,16 @@ public class ABookPermissionHelper {
if (ContextCompat.checkSelfPermission(mActivity, if (ContextCompat.checkSelfPermission(mActivity,
android.Manifest.permission.ACCESS_FINE_LOCATION) != PERMISSION_GRANTED) { android.Manifest.permission.ACCESS_FINE_LOCATION) != PERMISSION_GRANTED) {
// リソースパターンの適用 // リソースパターンの適用
permitionTextResourceId = PatternStringUtil.patternToInt(getApplicationContext(), permitionTextResourceId = PatternStringUtil.patternToInt(mActivity.getApplicationContext(),
R.string.msg_permission_dialog_location, R.string.msg_permission_dialog_location,
getUserPref(getApplicationContext(), AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)); getUserPref(mActivity.getApplicationContext(), AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0));
} }
if (ContextCompat.checkSelfPermission(mActivity, if (ContextCompat.checkSelfPermission(mActivity,
android.Manifest.permission.ACCESS_COARSE_LOCATION) != PERMISSION_GRANTED) { android.Manifest.permission.ACCESS_COARSE_LOCATION) != PERMISSION_GRANTED) {
// リソースパターンの適用 // リソースパターンの適用
permitionTextResourceId = PatternStringUtil.patternToInt(getApplicationContext(), permitionTextResourceId = PatternStringUtil.patternToInt(mActivity.getApplicationContext(),
R.string.msg_permission_dialog_location, R.string.msg_permission_dialog_location,
getUserPref(getApplicationContext(), AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)); getUserPref(mActivity.getApplicationContext(), AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0));
} }
break; break;
...@@ -140,9 +139,9 @@ public class ABookPermissionHelper { ...@@ -140,9 +139,9 @@ public class ABookPermissionHelper {
if (ContextCompat.checkSelfPermission(mActivity, if (ContextCompat.checkSelfPermission(mActivity,
android.Manifest.permission.CAMERA) != PERMISSION_GRANTED) { android.Manifest.permission.CAMERA) != PERMISSION_GRANTED) {
// リソースパターンの適用 // リソースパターンの適用
permitionTextResourceId = PatternStringUtil.patternToInt(getApplicationContext(), permitionTextResourceId = PatternStringUtil.patternToInt(mActivity.getApplicationContext(),
R.string.msg_permission_dialog_camera, R.string.msg_permission_dialog_camera,
getUserPref(getApplicationContext(), AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)); getUserPref(mActivity.getApplicationContext(), AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0));
} }
break; break;
case Constant.ABookPermissionType.Audio: case Constant.ABookPermissionType.Audio:
...@@ -150,9 +149,9 @@ public class ABookPermissionHelper { ...@@ -150,9 +149,9 @@ public class ABookPermissionHelper {
if (ContextCompat.checkSelfPermission(mActivity, if (ContextCompat.checkSelfPermission(mActivity,
android.Manifest.permission.RECORD_AUDIO) != PERMISSION_GRANTED) { android.Manifest.permission.RECORD_AUDIO) != PERMISSION_GRANTED) {
// リソースパターンの適用 // リソースパターンの適用
permitionTextResourceId = PatternStringUtil.patternToInt(getApplicationContext(), permitionTextResourceId = PatternStringUtil.patternToInt(mActivity.getApplicationContext(),
R.string.msg_permission_dialog_mic, R.string.msg_permission_dialog_mic,
getUserPref(getApplicationContext(), AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)); getUserPref(mActivity.getApplicationContext(), AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0));
} }
break; break;
...@@ -161,9 +160,9 @@ public class ABookPermissionHelper { ...@@ -161,9 +160,9 @@ public class ABookPermissionHelper {
if (ContextCompat.checkSelfPermission(mActivity, if (ContextCompat.checkSelfPermission(mActivity,
Manifest.permission.BLUETOOTH) != PERMISSION_GRANTED) { Manifest.permission.BLUETOOTH) != PERMISSION_GRANTED) {
// リソースパターンの適用 // リソースパターンの適用
permitionTextResourceId = PatternStringUtil.patternToInt(getApplicationContext(), permitionTextResourceId = PatternStringUtil.patternToInt(mActivity.getApplicationContext(),
R.string.msg_permission_dialog_bluetooth, R.string.msg_permission_dialog_bluetooth,
getUserPref(getApplicationContext(), AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)); getUserPref(mActivity.getApplicationContext(), AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0));
} }
break; break;
} }
...@@ -172,9 +171,9 @@ public class ABookPermissionHelper { ...@@ -172,9 +171,9 @@ public class ABookPermissionHelper {
if (showDialogFlg) { if (showDialogFlg) {
ABookAlertDialog dialog = AlertDialogUtil.createABookAlertDialog(mActivity); ABookAlertDialog dialog = AlertDialogUtil.createABookAlertDialog(mActivity);
// リソースパターンの適用 // リソースパターンの適用
dialog.setTitle(PatternStringUtil.patternToString(getApplicationContext(), dialog.setTitle(PatternStringUtil.patternToString(mActivity.getApplicationContext(),
R.string.title_permission_dialog, R.string.title_permission_dialog,
getUserPref(getApplicationContext(), AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0))); getUserPref(mActivity.getApplicationContext(), AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)));
dialog.setMessage(permitionTextResourceId); dialog.setMessage(permitionTextResourceId);
dialog.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { dialog.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
@Override @Override
......
...@@ -4,7 +4,6 @@ package jp.agentec.abook.abv.ui.viewer.activity; ...@@ -4,7 +4,6 @@ package jp.agentec.abook.abv.ui.viewer.activity;
* @author jang * @author jang
*/ */
import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Dialog; import android.app.Dialog;
import android.content.Context; import android.content.Context;
...@@ -119,6 +118,8 @@ import jp.agentec.abook.abv.cl.util.ContentLogUtil; ...@@ -119,6 +118,8 @@ import jp.agentec.abook.abv.cl.util.ContentLogUtil;
import jp.agentec.abook.abv.cl.util.PreferenceUtil; import jp.agentec.abook.abv.cl.util.PreferenceUtil;
import jp.agentec.abook.abv.launcher.android.R; import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.launcher.android.R.id; import jp.agentec.abook.abv.launcher.android.R.id;
import jp.agentec.abook.abv.ui.Interface.MovePageInterface;
import jp.agentec.abook.abv.ui.Interface.UnAuthorizedContentListener;
import jp.agentec.abook.abv.ui.common.activity.ABVContentViewActivity; import jp.agentec.abook.abv.ui.common.activity.ABVContentViewActivity;
import jp.agentec.abook.abv.ui.common.appinfo.AppColor; import jp.agentec.abook.abv.ui.common.appinfo.AppColor;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType; import jp.agentec.abook.abv.ui.common.appinfo.AppDefType;
...@@ -136,12 +137,8 @@ import jp.agentec.abook.abv.ui.common.util.PatternStringUtil; ...@@ -136,12 +137,8 @@ import jp.agentec.abook.abv.ui.common.util.PatternStringUtil;
import jp.agentec.abook.abv.ui.common.view.ABVEditText; import jp.agentec.abook.abv.ui.common.view.ABVEditText;
import jp.agentec.abook.abv.ui.common.view.ABVPopupListWindow; import jp.agentec.abook.abv.ui.common.view.ABVPopupListWindow;
import jp.agentec.abook.abv.ui.common.vo.Size; import jp.agentec.abook.abv.ui.common.vo.Size;
import jp.agentec.abook.abv.ui.home.activity.BarCodeReaderActivity;
import jp.agentec.abook.abv.ui.home.activity.PairingSettingActivity;
import jp.agentec.abook.abv.ui.home.helper.ABookCheckWebViewHelper; import jp.agentec.abook.abv.ui.home.helper.ABookCheckWebViewHelper;
import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper; import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper;
import jp.agentec.abook.abv.ui.Interface.MovePageInterface;
import jp.agentec.abook.abv.ui.Interface.UnAuthorizedContentListener;
import jp.agentec.abook.abv.ui.viewer.adapter.ContentBookmarkAdapter; import jp.agentec.abook.abv.ui.viewer.adapter.ContentBookmarkAdapter;
import jp.agentec.abook.abv.ui.viewer.adapter.ContentSearchPageAdapter; import jp.agentec.abook.abv.ui.viewer.adapter.ContentSearchPageAdapter;
import jp.agentec.abook.abv.ui.viewer.adapter.PDFIndexDialog; import jp.agentec.abook.abv.ui.viewer.adapter.PDFIndexDialog;
...@@ -161,9 +158,9 @@ import jp.agentec.abook.abv.ui.viewer.view.EnqueteWebView; ...@@ -161,9 +158,9 @@ import jp.agentec.abook.abv.ui.viewer.view.EnqueteWebView;
import jp.agentec.abook.abv.ui.viewer.view.FullVideoView; import jp.agentec.abook.abv.ui.viewer.view.FullVideoView;
import jp.agentec.abook.abv.ui.viewer.view.MarkingLayout; import jp.agentec.abook.abv.ui.viewer.view.MarkingLayout;
import jp.agentec.abook.abv.ui.viewer.view.MarkingView; import jp.agentec.abook.abv.ui.viewer.view.MarkingView;
import jp.agentec.abook.abv.ui.viewer.view.OperationTaskLayout;
import jp.agentec.abook.abv.ui.viewer.view.PageScrollView; import jp.agentec.abook.abv.ui.viewer.view.PageScrollView;
import jp.agentec.abook.abv.ui.viewer.view.PageView; import jp.agentec.abook.abv.ui.viewer.view.PageView;
import jp.agentec.abook.abv.ui.viewer.view.OperationTaskLayout;
import jp.agentec.abook.abv.ui.viewer.view.ThumbnailSeekBarLayout; import jp.agentec.abook.abv.ui.viewer.view.ThumbnailSeekBarLayout;
import jp.agentec.abook.abv.ui.viewer.view.ZoomRelativeLayout; import jp.agentec.abook.abv.ui.viewer.view.ZoomRelativeLayout;
import jp.agentec.abook.abv.ui.viewer.view.ZoomRelativeLayout.ViewMargin; import jp.agentec.abook.abv.ui.viewer.view.ZoomRelativeLayout.ViewMargin;
...@@ -3750,32 +3747,6 @@ public class ContentViewActivity extends ABVContentViewActivity { ...@@ -3750,32 +3747,6 @@ public class ContentViewActivity extends ABVContentViewActivity {
} }
mUploadMessage.onReceiveValue(result); mUploadMessage.onReceiveValue(result);
break; break;
// 機器連携と繋がる処理 get DeviceInfo
// case REQUEST_ENABLEBLUETOOTH: // Bluetooth有効化要求
// if( Activity.RESULT_CANCELED == resultCode )
// { // 有効にされなかった
// ABVToastUtil.showMakeText(getApplicationContext(), R.string.bluetooth_is_not_working, Toast.LENGTH_SHORT);
// return;
// }
// break;
// case REQUEST_CONNECTDEVICE: // デバイス接続要求
// String strDeviceName;
// if( Activity.RESULT_OK == resultCode ) {
// // デバイスリストアクティビティからの情報の取得
// strDeviceName = intent.getStringExtra( PairingSettingActivity.EXTRAS_DEVICE_NAME );
// mDeviceAddress = intent.getStringExtra( PairingSettingActivity.EXTRAS_DEVICE_ADDRESS );
// setUserPref(strDeviceName, mDeviceAddress, 1);
// } else {
// strDeviceName = "";
// mDeviceAddress = "";
// setUserPref(strDeviceName, mDeviceAddress, 0);
// }
// break;
case REQUEST_BARCODE_READER: // バーコードレーダから読み取ったデータの処理
if (Activity.RESULT_OK == resultCode) {
setBarCodeData(intent.getStringExtra(BarCodeReaderActivity.BARCODE_READING_DATA));
}
break;
} }
mUploadMessage = null; mUploadMessage = null;
} }
......
package jp.agentec.abook.abv.ui.viewer.activity; package jp.agentec.abook.abv.ui.viewer.activity;
import android.app.Activity; import android.app.Activity;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothGatt;
import android.bluetooth.BluetoothGattCallback;
import android.bluetooth.BluetoothGattCharacteristic;
import android.bluetooth.BluetoothGattDescriptor;
import android.bluetooth.BluetoothGattService;
import android.bluetooth.BluetoothManager;
import android.bluetooth.BluetoothProfile;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import android.view.View; import android.view.View;
import android.webkit.ValueCallback;
import android.widget.Button; import android.widget.Button;
import android.widget.ImageButton; import android.widget.ImageButton;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.Toast;
import java.io.File; import java.io.File;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.UUID;
import jp.agentec.abook.abv.bl.acms.client.json.content.ContentJSON; import jp.agentec.abook.abv.bl.acms.client.json.content.ContentJSON;
import jp.agentec.abook.abv.bl.acms.type.OperationType; import jp.agentec.abook.abv.bl.acms.type.OperationType;
...@@ -47,15 +32,14 @@ import jp.agentec.abook.abv.bl.logic.OperationLogic; ...@@ -47,15 +32,14 @@ import jp.agentec.abook.abv.bl.logic.OperationLogic;
import jp.agentec.abook.abv.cl.util.ContentLogUtil; import jp.agentec.abook.abv.cl.util.ContentLogUtil;
import jp.agentec.abook.abv.cl.util.PreferenceUtil; import jp.agentec.abook.abv.cl.util.PreferenceUtil;
import jp.agentec.abook.abv.launcher.android.R; import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.activity.ABVCheckContentViewActivity;
import jp.agentec.abook.abv.ui.common.activity.ABVContentViewActivity; import jp.agentec.abook.abv.ui.common.activity.ABVContentViewActivity;
import jp.agentec.abook.abv.ui.common.activity.ABVUIActivity;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType; import jp.agentec.abook.abv.ui.common.appinfo.AppDefType;
import jp.agentec.abook.abv.ui.common.constant.ErrorCode; import jp.agentec.abook.abv.ui.common.constant.ErrorCode;
import jp.agentec.abook.abv.ui.common.constant.ErrorMessage; import jp.agentec.abook.abv.ui.common.constant.ErrorMessage;
import jp.agentec.abook.abv.ui.common.dialog.ABookAlertDialog; import jp.agentec.abook.abv.ui.common.dialog.ABookAlertDialog;
import jp.agentec.abook.abv.ui.common.util.AlertDialogUtil; import jp.agentec.abook.abv.ui.common.util.AlertDialogUtil;
import jp.agentec.abook.abv.ui.common.util.PatternStringUtil; import jp.agentec.abook.abv.ui.common.util.PatternStringUtil;
import jp.agentec.abook.abv.ui.home.activity.PairingSettingActivity;
import jp.agentec.abook.abv.ui.home.helper.ABookCheckWebViewHelper; import jp.agentec.abook.abv.ui.home.helper.ABookCheckWebViewHelper;
import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper; import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper;
import jp.agentec.abook.abv.ui.home.helper.ContentViewHelper; import jp.agentec.abook.abv.ui.home.helper.ContentViewHelper;
...@@ -63,7 +47,7 @@ import jp.agentec.adf.util.DateTimeFormat; ...@@ -63,7 +47,7 @@ import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil; import jp.agentec.adf.util.DateTimeUtil;
import jp.agentec.adf.util.FileUtil; import jp.agentec.adf.util.FileUtil;
public class ParentWebViewActivity extends ABVContentViewActivity { public class ParentWebViewActivity extends ABVCheckContentViewActivity {
private static final String TAG = "ParentWebViewActivity"; private static final String TAG = "ParentWebViewActivity";
private LinearLayout historyLayout; private LinearLayout historyLayout;
...@@ -183,6 +167,8 @@ public class ParentWebViewActivity extends ABVContentViewActivity { ...@@ -183,6 +167,8 @@ public class ParentWebViewActivity extends ABVContentViewActivity {
taskListButton.setVisibility(View.VISIBLE); taskListButton.setVisibility(View.VISIBLE);
} }
progressDialog.setProgress(0); progressDialog.setProgress(0);
//中心温度計接続を切る
bleThermometerDisconnect();
} }
} }
...@@ -465,33 +451,4 @@ public class ParentWebViewActivity extends ABVContentViewActivity { ...@@ -465,33 +451,4 @@ public class ParentWebViewActivity extends ABVContentViewActivity {
webViewLoadUrl(url); webViewLoadUrl(url);
} }
// 機能の有効化ダイアログの操作結果
@Override
protected void onActivityResult( int requestCode, int resultCode, Intent data )
{
switch( requestCode )
{
case REQUEST_ENABLEBLUETOOTH: // Bluetooth有効化要求
if( Activity.RESULT_CANCELED == resultCode )
{ // 有効にされなかった
return;
}
break;
case REQUEST_CONNECTDEVICE: // デバイス接続要求
String strDeviceName;
if( Activity.RESULT_OK == resultCode )
{
// デバイスリストアクティビティからの情報の取得
// strDeviceName = data.getStringExtra( DeviceListActivity.EXTRAS_DEVICE_NAME );
mDeviceAddress = data.getStringExtra( PairingSettingActivity.EXTRAS_DEVICE_ADDRESS );
}
else
{
strDeviceName = "";
mDeviceAddress = "";
}
break;
}
super.onActivityResult( requestCode, resultCode, data );
}
} }
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