Commit bd120dc4 by Lee Jaebin

テスト用

parent 55aeeca4
......@@ -171,8 +171,11 @@ public class Constant {
// 連携機器の区分
public interface DeviceType {
int thermomete = 1; // 中心温度計
int centerThermomete = 1; // 中心温度計
int sensor = 2; // 置くだけセンサー
int barcode = 3; // バーコード
int radiationThermomete = 4; // 放射温度計
int weighingMachine = 5; // 放射温度計
int nfc = 6; // nfc機器
}
}
package jp.agentec.abook.abv.bl.dto;
/**
* bluetoothペアリング情報を扱うDto
* デバイス名、デバイスアドレス
*/
public class BluetoothPairingDeviceInfoDto {
/** デバイス名 */
public String deviceName;
/** デバイスアドレス*/
public String deviceAddress;
/** デバイスタイプ*/
public Integer deviceType;
}
......@@ -327,9 +327,11 @@ public class ContractLogic extends AbstractLogic {
boolean result;
try {
result = acmsDao.isTodayLastAnnounceChangePasswordDate();
Logger.d("--------------------result : " + result);
if (!result) {
acmsDao.beginTransaction();
acmsDao.updateLastAnnounceChangePasswordDate();
Logger.d("--------------------updateLastAnnounceChangePasswordDate");
acmsDao.commit();
}
} catch (Exception e) {
......
......@@ -680,4 +680,8 @@ public class StringUtil {
return str.startsWith(target);
}
// public static a(String str) {
// str = str.replace(Space, "").replace(CarriageReturn, "").replace(LineFeed, "");
// }
}
......@@ -21,6 +21,7 @@
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.NFC" />
<!-- GCM -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
......@@ -34,6 +35,9 @@
<!-- BLE -->
<uses-feature android:name="android.hardware.bluetooth_le" android:required="true"/>
<!-- NFC -->
<uses-feature android:name="android.hardware.nfc" android:required="true"/>
<permission
android:name="${applicationId}.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
......@@ -224,9 +228,13 @@
<activity android:name="jp.agentec.abook.abv.ui.viewer.activity.CheckOZDViewActivity" android:configChanges="orientation|screenSize"/>
<!-- ABookCheck1.0.0 Sato -->
<activity android:name="jp.agentec.abook.abv.ui.home.activity.PairingSettingActivity"
android:theme="@style/AppTheme"/>
<activity android:name="jp.agentec.abook.abv.ui.home.activity.BlePairingSettingActivity"
android:theme="@style/AppTheme"
android:configChanges="keyboardHidden|orientation|screenSize"/>
<activity android:name="jp.agentec.abook.abv.ui.home.activity.BarCodeReaderActivity"
android:theme="@style/AppTheme" android:configChanges="keyboardHidden|orientation|screenSize"/>
android:theme="@style/AppTheme"
android:configChanges="keyboardHidden|orientation|screenSize"/>
<activity android:name="jp.agentec.abook.abv.ui.home.activity.BluetoothPairingSettingActivity"
android:theme="@style/AppTheme"/>
</application>
</manifest>
\ No newline at end of file
......@@ -1399,23 +1399,36 @@
<!-- ABookCheck Sato 1.0.0 -->
<string name="set_title_pairing">ペアリング</string>
<string name="set_pairing_central_thermometer">中心温度計</string>
<string name="center_thermometer">中心温度計</string>
<string name="pairing_search_scan">スキャン</string>
<string name="pairing_search_scaning">スキャン中..</string>
<string name="pairing_search_stop">中止</string>
<string name="pairing_save_thermometer">登録された温度計</string>
<string name="pairing_other_thermometer">その他温度計</string>
<string name="pairing_other_thermometer_searching">その他温度計(検索中..)</string>
<string name="ble_connecting">接続中..</string>
<string name="msg_no_device_info">登録された中心温度計情報がありません。\n設定画面のペアリングの中心温度計から登録できます。</string>
<string name="ble_connecting">接続中...</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_ble_connect_success">%1$sと接続になりました。%1$sを操作してください。</string>
<string name="msg_scan_bluetooth_no_allow">BlueToothの利用を「許可」しないと、%1$sのスキャンができません。</string>
<string name="msg_connect_bluetooth_no_allow">BlueToothの利用を「許可」しないと、%1$sと接続できません。</string>
<string name="msg_location_device_no_allow">端末の設定から位置情報をONにしてください。</string>
<string name="bluetooth_is_not_supported">Bluetooth機能が利用できない端末です。</string>
<string name="barcode">コードリーダー</string>
<!-- ABookCheck Sato 1.0.2 -->
<string name="chino_machine">CHINO機器</string>
<string name="yamato_machine">大和機器</string>
<string name="radiation_thermometer">放射温度計</string>
<string name="weighing_machine">定量計量器</string>
<string name="pairing_save_machine">登録された%s</string>
<string name="pairing_other_machine">その他%s</string>
<string name="pairing_other_machine_searching">その他%s(検索中...)</string>
<string name="msg_bluetooth_connect_error">登録した%1$sと接続することができません。%1$sの電源を確認した後、再度お試しください。</string>
<string name="msg_pairing_device_no_info">登録された%s情報がありません。\n設定画面のペアリング設定から登録できます。</string>
<string name="msg_not_found_parameter">パラメータが存在しません。</string>
<string name="msg_fraud_parameter">パラメータに数値以外の文字列が含まれています。</string>
<string name="msg_dis_connect_error">接続することができません。電源を確認した後、再度お試しください。</string>
<string name="msg_okudake_fraud_parameter">おくだけセンサーのパラメータに数値以外の文字列が含まれています。</string>
<string name="msg_nfc_value_error">濃度のエラーが発生しました。(%s)</string>
<string name="msg_no_support_nfc">NFC機能が利用できない端末です。</string>
<string name="msg_no_nfc_setting">端末の設定からNFCを有効にする必要があります。\n端末の設定画面へ遷移しますか?</string>
</resources>
......@@ -1407,23 +1407,31 @@
<!-- ABookCheck Sato 1.0.0 -->
<string name="set_title_pairing">패어링</string>
<string name="set_pairing_central_thermometer">중심 온도계</string>
<string name="center_thermometer">중심 온도계</string>
<string name="pairing_search_scan">스캔</string>
<string name="pairing_search_scaning">스캔중..</string>
<string name="pairing_search_stop">중지</string>
<string name="pairing_save_thermometer">등록된 온도계</string>
<string name="pairing_other_thermometer">그 밖에 온도계</string>
<string name="pairing_other_thermometer_searching">그 밖에 온도계(검색중..)</string>
<string name="ble_connecting">접속 시도 중..</string>
<string name="msg_no_device_info">등록된 중심 온도계 정보가 없습니다.\n 설정 화면의 페어링의 중심 온도계에서 등록 가능합니다.</string>
<string name="ble_connecting">접속 시도 중...</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_ble_connect_success">%1$s와 연결되었습니다. %1$s를 조작 해 주세요.</string>
<string name="msg_scan_bluetooth_no_allow">블루투스 사용를 [허용] 하지 않으면, %1$s 스캔이 불가능 합니다. </string>
<string name="msg_connect_bluetooth_no_allow">블루투스 사용를 [허용] 하지 않으면, %1$s와 연결이 불가능 합니다.</string>
<string name="msg_location_device_no_allow">단말기의 설정에서 위치정보를 ON으로 설정해 주세요.</string>
<string name="bluetooth_is_not_supported">블루투스는 지원되지 않습니다.</string>
<string name="barcode">코드 리더</string>
<string name="msg_okudake_fraud_parameter">오쿠다케 센서의 파라미터에 숫자가 아닌 문자열이 포합되어 있습니다.</string>
<!-- ABookCheck Sato 1.0.2 -->
<string name="chino_machine">CHINO機器</string>
<string name="yamato_machine">大和機器</string>
<string name="radiation_thermometer">放射温度計</string>
<string name="weighing_machine">定量計量器</string>
<string name="pairing_save_machine">등록된 %s</string>
<string name="pairing_other_machine">그 밖에 %s</string>
<string name="pairing_other_machine_searching">그 밖에 %s(검색중...)</string>
<string name="msg_bluetooth_connect_error">登録した%1$sと接続することができません。%1$sの電源を確認した後、再度お試しください。</string>
<string name="msg_pairing_device_no_info">登録された%s情報がありません。\n設定画面のペアリング設定から登録できます。</string>
<string name="msg_not_found_parameter">파라미터가 존재하지 않습니다.</string>
<string name="msg_fraud_parameter">파라미터에 숫자가 아닌 문자열이 포합되어 있습니다.</string>
<string name="msg_dis_connect_error">接続することができません。電源を確認した後、再度お試しください。</string>
<string name="msg_no_support_nfc">NFC機能が利用できない端末です。</string>
<string name="msg_no_nfc_setting">端末の設定からNFCを有効にする必要があります。\n端末の設定画面へ遷移しますか?</string>
</resources>
\ No newline at end of file
......@@ -1405,24 +1405,32 @@
<!-- ABookCheck Sato 1.0.0 -->
<string name="set_title_pairing">Pairing</string>
<string name="set_pairing_central_thermometer">Central thermometer</string>
<string name="center_thermometer">Central thermometer</string>
<string name="pairing_search_scan">Scan</string>
<string name="pairing_search_scaning">Scaning..</string>
<string name="pairing_search_scaning">Scaning...</string>
<string name="pairing_search_stop">Stop</string>
<string name="pairing_save_thermometer">Saved thermometer</string>
<string name="pairing_other_thermometer">Other thermometer</string>
<string name="pairing_other_thermometer_searching">Other thermometer(Searching..)</string>
<string name="ble_connecting">Connection..</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="ble_connecting">Connection...</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_ble_connect_success">Connected with %1$s. Please control %1$s.</string>
<string name="msg_scan_bluetooth_no_allow">If Bluetooth is not allow, %1$s scan is disabled.</string>
<string name="msg_connect_bluetooth_no_allow">If Bluetooth is not allow, %1$s connect is disabled.</string>
<string name="msg_location_device_no_allow">Please set the location information to ON in the device setting.</string>
<string name="bluetooth_is_not_supported">Bluetooth is not supported.</string>
<string name="barcode">Code Reader</string>
<string name="msg_okudake_fraud_parameter">The okudake sensor parameter contains a non-numeric string.</string>
<!-- ABookCheck Sato 1.0.2 -->
<string name="chino_machine">CHINO機器</string>
<string name="yamato_machine">大和機器</string>
<string name="radiation_thermometer">放射温度計</string>
<string name="weighing_machine">定量計量器</string>
<string name="pairing_save_machine">Saved %s</string>
<string name="pairing_other_machine">Other %s</string>
<string name="pairing_other_machine_searching">Other %s(Searching...)</string>
<string name="msg_bluetooth_connect_error">登録した%1$sと接続することができません。%1$sの電源を確認した後、再度お試しください。</string>
<string name="msg_pairing_device_no_info">登録された%s情報がありません。\n設定画面のペアリング設定から登録できます。</string>
<string name="msg_not_found_parameter">パラメータが存在しません。</string>
<string name="msg_fraud_parameter">The parameter contains a non-numeric string.</string>
<string name="msg_dis_connect_error">接続することができません。電源を確認した後、再度お試しください。</string>
<string name="msg_no_support_nfc">NFC機能が利用できない端末です。</string>
<string name="msg_no_nfc_setting">端末の設定からNFCを有効にする必要があります。\n端末の設定画面へ遷移しますか?</string>
</resources>
\ No newline at end of file
......@@ -13,6 +13,7 @@
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.NFC" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/root_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/operation_bg"
android:minWidth="500dp"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/toolbar_layout"
style="@style/OperationSearchToolBar"
android:layout_width="match_parent"
android:layout_height="50dp">
<TextView
android:id="@+id/title"
style="@style/DialogToolBarTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="@string/search"
android:textColor="@color/edt_text"
android:textSize="@dimen/opeartion_title_text_size" />
<Button
android:id="@+id/closeBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:background="@drawable/ic_operation_close"
android:contentDescription="@string/cont_desc" />
</RelativeLayout>
<ListView
android:id="@+id/listView1"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</ListView>
</LinearLayout>
\ No newline at end of file
......@@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="jp.agentec.abook.abv.ui.home.activity.PairingSettingActivity">
tools:context="jp.agentec.abook.abv.ui.home.activity.BlePairingSettingActivity">
<!--android:background="@drawable/setting_bg"-->
<!--android:layout_height="0dp"-->
<!--android:background="@drawable/setting_bg"-->
......
......@@ -60,8 +60,12 @@
</PreferenceCategory>
<PreferenceCategory android:title="@string/set_title_pairing" android:key="set_pairing">
<PreferenceScreen
android:key="setPairing"
android:title="@string/set_pairing_central_thermometer" >
android:key="setChinoPairing"
android:title="CHINO機器" >
</PreferenceScreen>
<PreferenceScreen
android:key="setSppPairing"
android:title="SPP通信機器" >
</PreferenceScreen>
</PreferenceCategory>
</PreferenceScreen>
\ No newline at end of file
package jp.agentec.abook.abv.cl.util;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothSocket;
import android.util.Log;
import java.io.IOException;
import java.util.Set;
import java.util.UUID;
import jp.agentec.abook.abv.bl.common.log.Logger;
public class BluetoothConnectThread extends Thread {
protected String TAG = "BluetoothConnectThread";
// "00001101-0000-1000-8000-00805f9b34fb" = SPP (シリアルポートプロファイル) の UUID.
public static final UUID SPP_UUID = UUID.fromString("00001101-0000-1000-8000-00805f9b34fb");
private BluetoothSocket mSocket;
private bluetoothConnectThreadListener mListener;
public interface bluetoothConnectThreadListener {
void onConnect(BluetoothSocket socket); // 接続リスナ
void onFail();
}
public BluetoothConnectThread(BluetoothDevice device, bluetoothConnectThreadListener listener) {
BluetoothSocket tmp = null;
mListener = listener;
try {
tmp = device.createRfcommSocketToServiceRecord(SPP_UUID);
} catch (IOException e) {
e.printStackTrace();
// NOP.
}
mSocket = tmp;
}
@Override
public void run() {
if (mSocket == null) {
Logger.e(TAG, "socket is null");
return;
}
try {
mSocket.connect();
} catch (IOException e) {
Logger.e(TAG, e);
try {
mSocket.close();
} catch (IOException e1) {
Logger.e(TAG, e);
}
mListener.onFail();
return;
}
mListener.onConnect(mSocket);
Log.i(TAG, "Bluetooth connecting.");
}
public boolean isConnecting() {
return mSocket.isConnected();
}
}
\ No newline at end of file
package jp.agentec.abook.abv.cl.util;
import android.bluetooth.BluetoothSocket;
import android.content.Context;
import android.util.Log;
import android.widget.Toast;
import java.io.IOException;
import java.io.InputStream;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.activity.ABVCheckContentViewActivity;
import jp.agentec.abook.abv.ui.common.util.ABVToastUtil;
public class BluetoothReceiveTask extends Thread {
public static final String TAG = "BluetoothReceiveTask";
protected InputStream mInputStream;
protected BluetoothSocket mSocket;
private int mStartIndex;
private int mEndIndex;
private Context mContext;
private static final int STX = 2;
private static final int ETX = 3;
private BluetoothReceiveTaskListener mListener;
public interface BluetoothReceiveTaskListener {
void onGetData(String result); // 値取得時のリスナ
void onFail(); // 失敗リスナ
}
public BluetoothReceiveTask(Context context, BluetoothSocket socket, int startIndex, int endIndex, BluetoothReceiveTaskListener listener) {
mContext = context;
mSocket = null;
mInputStream = null;
mStartIndex = startIndex;
mEndIndex = endIndex;
mListener = listener;
if (socket == null) {
Logger.e(TAG, "parameter socket is null.");
mListener.onFail();
return;
}
try {
mSocket = socket;
mInputStream = socket.getInputStream();
} catch (IOException e) {
Logger.e(TAG, e);
mListener.onFail();
return;
}
}
@Override
public void run() {
Logger.i(TAG, "bluetoothReciveTask run");
byte[] buffer = new byte[1024];
int readSize = 0;
while (mInputStream != null) {
Logger.i(TAG, "start read mInputStream.");
if (mSocket == null) {
Logger.e(TAG, "mSocket is null.");
break;
}
try {
readSize = mInputStream.read(buffer);
String str = new String(buffer, 0, readSize);
Logger.i("str : " + str);
if (str.indexOf(new Character((char)STX).toString()) > -1 && str.indexOf(new Character((char)ETX).toString()) > -1) {
Logger.i("----------------------------------str : " + str);
String dataStr = str.substring(str.indexOf(new Character((char)STX).toString()) + 1, str.indexOf(new Character((char)ETX).toString()));
String result = dataStr.substring(mStartIndex - 1, mEndIndex - 1).replaceAll(" ","");
ABVToastUtil.showMakeText(mContext, "実際のデータ:" + dataStr + "\n切り分け文字開始時点:" + mStartIndex + " 終了時点 : " + mEndIndex + "\n 切り分けしたデータ:" + result , Toast.LENGTH_LONG);
mListener.onGetData(result);
}
Thread.sleep(500);
} catch (Exception e) {
Logger.e(TAG, e);
mListener.onFail();
break;
}
}
Logger.i(TAG, "exit read task.");
}
/**
* ソケットを初期化処理
*/
public void finish() {
if (mSocket == null) {
return;
}
try {
mSocket.close();
mSocket = null;
} catch (IOException e) {
e.printStackTrace();
}
}
}
\ No newline at end of file
......@@ -2,8 +2,10 @@ package jp.agentec.abook.abv.launcher.android;
import java.util.ArrayList;
import jp.agentec.abook.abv.bl.common.Constant.DeviceType;
import jp.agentec.abook.abv.bl.common.Constant.ReportType;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.dto.BluetoothPairingDeviceInfoDto;
import jp.agentec.abook.abv.cl.util.PreferenceUtil;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType.DefPrefKey;
......@@ -111,6 +113,10 @@ public class ABVUIDataCache {
}
}
/**
* フィルターのタイプIDの値セット
* @param operationReportTypes
*/
public void setOperationReportTypes(ArrayList<Integer> operationReportTypes) {
this.mReportTypes = operationReportTypes;
String val = null;
......@@ -126,6 +132,10 @@ public class ABVUIDataCache {
PreferenceUtil.putUserPref(context, UserPrefKey.OPERATION_REPORT_TYPES, val);
}
/**
* フィルターID情報リスト取得
* @return フィルター用のタイプIDリスト
*/
public ArrayList<Integer> getOperationReportTypes() {
String operationReportTypesStr = PreferenceUtil.getUserPref(context, UserPrefKey.OPERATION_REPORT_TYPES, null);
......@@ -147,4 +157,123 @@ public class ABVUIDataCache {
return mReportTypes;
}
/**
* アプリ内で保存されてるbluetoothのペアリング情報の
* BluetoothPairingDeviceInfoDtoで返す。
*
* 情報が存在しない場合はnullで返す。
*
* @param bluetoothDeviceType 取得するbluetoothのデバイスタイプ
* @return BluetoothPairingDeviceInfoDto ペアリング情報
*/
public BluetoothPairingDeviceInfoDto getPairingBluetoothDeviceInfo(int bluetoothDeviceType) {
BluetoothPairingDeviceInfoDto dto = new BluetoothPairingDeviceInfoDto();
String deviceName = null;
String deviceAddress = null;
if (bluetoothDeviceType == DeviceType.centerThermomete) {
// 中心温度計
deviceName = PreferenceUtil.getUserPref(context, UserPrefKey.BLE_DEVICE_CENTER_TEMPERATURE_NAME, "");
deviceAddress = PreferenceUtil.getUserPref(context, UserPrefKey.BLE_DEVICE_CENTER_TEMPERATURE_ADDRESS, "");
} else if (bluetoothDeviceType == DeviceType.radiationThermomete) {
// 放射温度計
deviceName = PreferenceUtil.getUserPref(context, UserPrefKey.BLE_DEVICE_RADIATION_TEMPERATURE_NAME, "");
deviceAddress = PreferenceUtil.getUserPref(context, UserPrefKey.BLE_DEVICE_RADIATION_TEMPERATURE_ADDRESS, "");
} else if (bluetoothDeviceType == DeviceType.weighingMachine) {
// 定量計量器
deviceName = PreferenceUtil.getUserPref(context, UserPrefKey.BLUETOOTH_DEVICE_WEIGHING_MACHINE_NAME, "");
deviceAddress = PreferenceUtil.getUserPref(context, UserPrefKey.BLUETOOTH_DEVICE_WEIGHING_MACHINE_ADDRESS, "");
}
// deviceNameとdeviceAddressがセットなので、どっちかの値が存在しないとnullで返す。
if (StringUtil.isNullOrEmpty(deviceName) || StringUtil.isNullOrEmpty(deviceAddress)) {
return null;
}
dto.deviceName = deviceName;
dto.deviceAddress = deviceAddress;
dto.deviceType = bluetoothDeviceType;
return dto;
}
/**
* 引数のデバイスタイプでローカルに保存されてるbluetoothのデバイスアドレス取得
* @param bluetoothDeviceType
* @return
*/
public String getPairingBluetoothDeviceAddress(int bluetoothDeviceType) {
String deviceAddressKey = null;
if (bluetoothDeviceType == DeviceType.centerThermomete) {
deviceAddressKey = UserPrefKey.BLE_DEVICE_CENTER_TEMPERATURE_ADDRESS;
} else if (bluetoothDeviceType == DeviceType.radiationThermomete) {
deviceAddressKey = UserPrefKey.BLE_DEVICE_RADIATION_TEMPERATURE_ADDRESS;
} else if (bluetoothDeviceType == DeviceType.weighingMachine) {
deviceAddressKey = UserPrefKey.BLUETOOTH_DEVICE_WEIGHING_MACHINE_ADDRESS;
}
if (deviceAddressKey == null) {
// 引数のデバイスタイプが定義した以外の値が入った場合
return null;
}
return PreferenceUtil.getUserPref(context, deviceAddressKey, "");
}
/**
* 引数であるデバイスタイプリストに対するアプリ内で保存されてる
* bluetoothのペアリング情報リストを返す。
* @param deviceTypeList
* @return List<BluetoothPairingDeviceInfoDto> ペアリング情報リスト
*/
public List<BluetoothPairingDeviceInfoDto> getPairingBluetoothDeviceInfoList(List<Integer> deviceTypeList) {
List<BluetoothPairingDeviceInfoDto> bluetoothPairingDeviceInfoDtoList = new ArrayList<BluetoothPairingDeviceInfoDto>();
for (Integer deviceType : deviceTypeList) {
BluetoothPairingDeviceInfoDto dto = getPairingBluetoothDeviceInfo(deviceType);
if (dto != null) {
bluetoothPairingDeviceInfoDtoList.add(dto);
}
}
return bluetoothPairingDeviceInfoDtoList;
}
/**
* ペアリング情報をローカルに保存する
* deviceType毎に保存するキーが異なる
* @param pairingDeviceInfoDto
*/
public void setPairingBluetoothDeviceInfo(BluetoothPairingDeviceInfoDto pairingDeviceInfoDto) {
if (pairingDeviceInfoDto.deviceType.equals(DeviceType.centerThermomete)) {
// 中心温度計
PreferenceUtil.putUserPref(context, UserPrefKey.BLE_DEVICE_CENTER_TEMPERATURE_NAME, pairingDeviceInfoDto.deviceName);
PreferenceUtil.putUserPref(context, UserPrefKey.BLE_DEVICE_CENTER_TEMPERATURE_ADDRESS, pairingDeviceInfoDto.deviceAddress);
} else if (pairingDeviceInfoDto.deviceType.equals(DeviceType.radiationThermomete)) {
// 放射温度計
PreferenceUtil.putUserPref(context, UserPrefKey.BLE_DEVICE_RADIATION_TEMPERATURE_NAME, pairingDeviceInfoDto.deviceName);
PreferenceUtil.putUserPref(context, UserPrefKey.BLE_DEVICE_RADIATION_TEMPERATURE_ADDRESS, pairingDeviceInfoDto.deviceAddress);
} else if (pairingDeviceInfoDto.deviceType.equals(DeviceType.weighingMachine)) {
// 定量軽量器
PreferenceUtil.putUserPref(context, UserPrefKey.BLUETOOTH_DEVICE_WEIGHING_MACHINE_NAME, pairingDeviceInfoDto.deviceName);
PreferenceUtil.putUserPref(context, UserPrefKey.BLUETOOTH_DEVICE_WEIGHING_MACHINE_ADDRESS, pairingDeviceInfoDto.deviceAddress);
}
}
/**
* 引数であるデバイスタイプの
* ペアリング情報を削除する
* @param deviceType
*/
public void removePairingBluetoothDeviceInfo(int deviceType) {
if (deviceType == DeviceType.centerThermomete) {
// 中心温度計
PreferenceUtil.removeUserPref(context, UserPrefKey.BLE_DEVICE_CENTER_TEMPERATURE_NAME);
PreferenceUtil.removeUserPref(context, UserPrefKey.BLE_DEVICE_CENTER_TEMPERATURE_ADDRESS);
} else if (deviceType == DeviceType.radiationThermomete) {
// 放射温度計
PreferenceUtil.removeUserPref(context, UserPrefKey.BLE_DEVICE_RADIATION_TEMPERATURE_NAME);
PreferenceUtil.removeUserPref(context, UserPrefKey.BLE_DEVICE_RADIATION_TEMPERATURE_ADDRESS);
} else if (deviceType == DeviceType.weighingMachine) {
// 定量軽量器
PreferenceUtil.removeUserPref(context, UserPrefKey.BLUETOOTH_DEVICE_WEIGHING_MACHINE_NAME);
PreferenceUtil.removeUserPref(context, UserPrefKey.BLUETOOTH_DEVICE_WEIGHING_MACHINE_ADDRESS);
}
}
}
......@@ -57,8 +57,17 @@ public interface AppDefType {
String RESOURCE_PATTERN_TYPE = "resourcePatternType"; // 文言リソースパターン
String BLUETOOTH_DEVICE_TEMPERATURE_NAME = "bleDeviceTemperatureName"; // 温度計機器の名
String BLUETOOTH_DEVICE_TEMPERATURE_ADDRESS = "bleDeviceTemperatureAddress"; // 温度計機器のアドレス
// 中心温度計
String BLE_DEVICE_CENTER_TEMPERATURE_NAME = "bleDeviceCenterTemperatureName"; // 中心温度計機器の名
String BLE_DEVICE_CENTER_TEMPERATURE_ADDRESS = "bleDeviceCenterTemperatureAddress"; // 中心温度計機器のアドレス
// 放射温度計
String BLE_DEVICE_RADIATION_TEMPERATURE_NAME = "bleDeviceRadiationTemperatureName"; // 放射温度計機器の名
String BLE_DEVICE_RADIATION_TEMPERATURE_ADDRESS = "bleDeviceRadiationTemperatureAddress"; // 放射温度計機器のアドレス
// 定量計量器
String BLUETOOTH_DEVICE_WEIGHING_MACHINE_NAME = "bluetoothDeviceWeighingMachineName"; // 定量軽量器の名
String BLUETOOTH_DEVICE_WEIGHING_MACHINE_ADDRESS = "bluetoothDeviceWeighingMachineAddress"; // 定量軽量器のアドレス
String MASTER_DATA_FETCH_DATE = "masterDataFetchDate"; // マスタデータのFetchDate
}
......
......@@ -35,7 +35,6 @@ import jp.agentec.abook.abv.bl.acms.type.AcmsApis;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.CommonExecutor;
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.bl.data.ABVDataCache;
import jp.agentec.abook.abv.bl.dto.MemberInfoDto;
......@@ -49,12 +48,10 @@ import jp.agentec.abook.abv.launcher.android.OnAppDownloadReceiver;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType.UserPrefKey;
import jp.agentec.abook.abv.ui.common.appinfo.options.Options;
import jp.agentec.abook.abv.ui.common.dialog.ABookAlertDialog;
import jp.agentec.abook.abv.ui.common.helper.ProgressDialogHelper;
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.PatternStringUtil;
import jp.agentec.abook.abv.ui.home.helper.ABookPermissionHelper;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
......@@ -91,7 +88,8 @@ public class ABookSettingFragment extends PreferenceFragment {
private SharedPreferences pref;
// 機器連携
private static final String SET_PAIRING = "setPairing";
private static final String SET_CHINO_PAIRING = "setChinoPairing";
private static final String SET_SPP_PAIRING = "setSppPairing";
@Override
public void onCreate(Bundle savedInstanceState) {
......@@ -475,16 +473,32 @@ public class ABookSettingFragment extends PreferenceFragment {
// 機器連携のペアリング設定
private void setPairingSetting() {
PreferenceGroup devicePairing = (PreferenceGroup) findPreference(SET_PAIRING);
PreferenceGroup chinoDevicePairing = (PreferenceGroup) findPreference(SET_CHINO_PAIRING);
devicePairing.setOnPreferenceClickListener(new OnPreferenceClickListener() {
chinoDevicePairing.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
try {
// ペアリング設定画面
Intent intent = new Intent();
intent.setClass(getActivity(), PairingSettingActivity.class);
intent.putExtra("beforeView", SET_PAIRING);
intent.setClass(getActivity(), BlePairingSettingActivity.class);
startActivity(intent);
} catch (Exception e) {
Logger.e(TAG, e);
}
return true;
}
});
PreferenceGroup yamotoDevicePairing = (PreferenceGroup) findPreference(SET_SPP_PAIRING);
yamotoDevicePairing.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
try {
// ペアリング設定画面
Intent intent = new Intent();
intent.setClass(getActivity(), BluetoothPairingSettingActivity.class);
startActivity(intent);
} catch (Exception e) {
Logger.e(TAG, e);
......
......@@ -9,6 +9,7 @@ import jp.agentec.abook.abv.bl.acms.type.RequirePasswordChangeType;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.CommonExecutor;
import jp.agentec.abook.abv.bl.common.Constant;
import jp.agentec.abook.abv.bl.common.Constant.DeviceType;
import jp.agentec.abook.abv.bl.common.Constant.ExceptionDetailMessage;
import jp.agentec.abook.abv.bl.common.exception.ABVException;
import jp.agentec.abook.abv.bl.common.exception.ABVExceptionCode;
......@@ -19,6 +20,7 @@ import jp.agentec.abook.abv.bl.data.dao.AbstractDao;
import jp.agentec.abook.abv.bl.data.dao.AcmsDao;
import jp.agentec.abook.abv.bl.data.dao.MemberInfoDao;
import jp.agentec.abook.abv.bl.download.ContentRefresher;
import jp.agentec.abook.abv.bl.dto.BluetoothPairingDeviceInfoDto;
import jp.agentec.abook.abv.bl.dto.MemberInfoDto;
import jp.agentec.abook.abv.bl.dto.PasswordLockInfoDto;
import jp.agentec.abook.abv.bl.logic.AbstractLogic;
......@@ -37,6 +39,7 @@ 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.helper.ABVViewUnbindHelper;
import jp.agentec.abook.abv.ui.common.util.AlertDialogUtil;
import jp.agentec.adf.util.CollectionUtil;
import jp.agentec.adf.util.StringUtil;
import android.content.DialogInterface;
import android.content.Intent;
......@@ -56,6 +59,8 @@ import android.widget.ImageButton;
import android.widget.TextView;
import android.widget.Toast;
import java.util.List;
/**
* @author Minhyuk Seok
* @editor Jang
......@@ -639,10 +644,9 @@ public class LoginActivity extends ABVLoginActivity {
* ユーザ変更時の初期化
*/
private void changeUserInit() {
//中心温度計の情報維持のため、PreferenceUtil初期化前にデータ取得
String deviceName = getUserPref(AppDefType.UserPrefKey.BLUETOOTH_DEVICE_TEMPERATURE_NAME, "");
String deviceAddress = getUserPref(AppDefType.UserPrefKey.BLUETOOTH_DEVICE_TEMPERATURE_ADDRESS, "");
// bluetoothの情報維持のため、PreferenceUtil初期化前にデータ取得
BluetoothPairingDeviceInfoDto centerThermometeInfoDto = getABVUIDataCache().getPairingBluetoothDeviceInfo(DeviceType.centerThermomete);
BluetoothPairingDeviceInfoDto radiationThermometeInfoDto = getABVUIDataCache().getPairingBluetoothDeviceInfo(DeviceType.radiationThermomete);
PreferenceUtil.clear(this);
getABVUIDataCache().clear();
......@@ -650,9 +654,12 @@ public class LoginActivity extends ABVLoginActivity {
memberInfoDao.deleteMemberInfo();
//PreferenceUtil初期化後、中心温度計の情報保存
if (deviceAddress.length() != 0) {
putUserPref(AppDefType.UserPrefKey.BLUETOOTH_DEVICE_TEMPERATURE_NAME, deviceName);
putUserPref(AppDefType.UserPrefKey.BLUETOOTH_DEVICE_TEMPERATURE_ADDRESS, deviceAddress);
if (centerThermometeInfoDto != null) {
getABVUIDataCache().setPairingBluetoothDeviceInfo(centerThermometeInfoDto);
}
if (radiationThermometeInfoDto != null) {
getABVUIDataCache().setPairingBluetoothDeviceInfo(radiationThermometeInfoDto);
}
contentLogic.deleteContentMarkingData();
......
......@@ -22,7 +22,7 @@ public class BleListAdapter extends BaseSectionAdapter<SectionHeaderData, BleLis
public interface BleListAdapterListener {
// 登録されたデバイス情報削除
void onDeleteConnectInfo();
void onDeleteConnectInfo(BleListRowData rowData);
}
public BleListAdapter(Context context, List<SectionHeaderData> sectionList,
......@@ -62,7 +62,7 @@ public class BleListAdapter extends BaseSectionAdapter<SectionHeaderData, BleLis
} else {
holder = (ListRowViewHolder) convertView.getTag();
}
BleListRowData rowData = rowList.get(indexPath.section).get(indexPath.row);
final BleListRowData rowData = rowList.get(indexPath.section).get(indexPath.row);
holder.bl_title.setText(rowData.title);
//スキャンされた温度計表示時に削除ボタンと接続ステータス非表示
......@@ -73,7 +73,7 @@ public class BleListAdapter extends BaseSectionAdapter<SectionHeaderData, BleLis
holder.bl_deleteBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
listener.onDeleteConnectInfo();
listener.onDeleteConnectInfo(rowData);
}
});
}
......
......@@ -27,4 +27,10 @@ public class BleListRowData extends SectionRowData {
this.deviceAddress = deviceAddress;
this.isSaved = isSaved;
}
public BleListRowData(String title, String subTitle, String deviceAddress, boolean isSaved) {
super(title, subTitle);
this.deviceAddress = deviceAddress;
this.isSaved = isSaved;
}
}
package jp.agentec.abook.abv.ui.home.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import java.util.List;
import jp.agentec.abook.abv.bl.dto.FixPushMessageDto;
import jp.agentec.abook.abv.launcher.android.R;
/**
* Created by kim jinsung on 2018/09/15.
*/
public class SelectDeviceAdapter extends ArrayAdapter<Object> {
private LayoutInflater mInflater;
private List<Object> mObjects;
public SelectDeviceAdapter(Context context, List<Object> objects) {
super(context, 0, objects);
mObjects = objects;
mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
final ViewHolder holder;
if (convertView == null) {
convertView = mInflater.inflate(android.R.layout.simple_list_item_1, parent, false);
holder = new ViewHolder();
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
TextView textView = (TextView) convertView;
textView.setText((String) mObjects.get(position));
return convertView;
}
private class ViewHolder {
TextView titleTextView;
TextView messageTextView;
ImageView selectedImageView;
}
}
......@@ -40,7 +40,6 @@ 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.util.AlertDialogUtil;
import jp.agentec.abook.abv.ui.common.util.PatternStringUtil;
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.ContentViewHelper;
import jp.agentec.adf.util.DateTimeFormat;
......@@ -148,7 +147,7 @@ public class ParentWebViewActivity extends ABVCheckContentViewActivity {
}
progressDialog.setProgress(0);
//中心温度計接続を切る
bleThermometerDisconnect();
bleManagerDisconnect();
}
}
......
......@@ -38,8 +38,8 @@ app_versioncode=1
# abvEnvironments.xml
#cms server
acms_address=https://check.abookcloud.com/acms
download_server_address=https://check.abookcloud.com/acms
acms_address=https://abook188-1.abook.bz/acms
download_server_address=https://abook188-1.abook.bz/acms
#syncview server
websocket_server_http_url=https://abook188-1.abook.bz/v1
......@@ -117,7 +117,7 @@ push_message=1
#手動更新
#0:非表示 1:表示 1.3.1
check_app_update=1
check_app_update=0
#ユーザ切り替え時全社グループのコンテンツを削除しない
#0:全てのコンテンツ削除 1:全社のコンテンツ削除しない 1.5.3
......
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