Commit fb4c1d5a authored by idic's avatar idic

很像可以work 應該

parent a85fa243
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
......@@ -41,7 +41,7 @@
<provider
android:name=".storage.PrivacyPolicyProvider"
android:authorities="@string/content_authority"
android:exported="false"/>
android:exported="true"/>
<activity
android:name=".DeviceOperatorActivity"/>
......
......@@ -227,10 +227,10 @@ public class MainActivity extends AppCompatActivity {
manufacturerData = manufacturerSpecificDataSparseArray.get(key);
}
String uuid = null;
BluetoothDevice device = result.getDevice();
if (null != manufacturerData && BeaconType.NORMAL_BEACON == BeaconUtils.getBeaconType(manufacturerData)) {
uuid = BeaconUtils.calculateUuidString(Arrays.copyOfRange(manufacturerData, 2, 18));
}
BluetoothDevice device = result.getDevice();
return new BluetoothDeviceInformation()
.setName(device == null ? null : device.getName())
.setAddress(device == null ? null : device.getAddress())
......
......@@ -37,7 +37,7 @@ public class ScanResultRecyclerViewAdapter extends RecyclerView.Adapter<ScanResu
List<BluetoothDeviceInformation> devices) {
this.BONDED_STRING = resources.getString(R.string.bluetooth_bonded);
this.NOT_BONDED_STRING = resources.getString(R.string.bluetooth_not_bonded);
this.RSSI_UNIT = " " + resources.getString(R.string.rssi_unit);
this.RSSI_UNIT = " " + resources.getString(R.string.unit_rssi);
this.mOnPolicyImageClickListener = mOnPolicyImageClickListener;
this.mOnConnectButtonClickListener = mOnConnectButtonClickListener;
this.devices = devices;
......
......@@ -2,6 +2,8 @@ package org.prlab.idic.privacypolicy.ble;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothGatt;
import android.bluetooth.BluetoothGattCharacteristic;
import android.bluetooth.BluetoothGattDescriptor;
/**
* Created by IDIC on 2017/2/21.
......@@ -9,8 +11,10 @@ import android.bluetooth.BluetoothGatt;
public interface BLECustomScript {
void onDiscoverServiceCompleted(BluetoothGatt gatt);
void onWriteCompleted(BluetoothGatt gatt, int status, byte[] values);
void onReadCompleted(BluetoothGatt gatt, int status, byte[] values);
void onWriteCharacteristicCompleted(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status, byte[] values);
void onReadCharacteristicCompleted(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status, byte[] values);
void onWriteDescriptorCompleted(BluetoothGatt gatt, BluetoothGattDescriptor descriptor, int status, byte[] values);
void onReadDescriptorCompleted(BluetoothGatt gatt, BluetoothGattDescriptor descriptor, int status, byte[] values);
void onPairRequestReceived(BluetoothDevice device, int pin);
void onPaired(BluetoothDevice device);
void onUnpaired(BluetoothDevice device);
......
......@@ -125,8 +125,12 @@ public class BaseUtils {
return UUIDs;
}
public static byte[] intArrray2ByteArray(int i) {
return ByteBuffer.allocate(4).putInt(1695609641).array();
public static byte[] int2Bytes(int i) {
return ByteBuffer.allocate(4).putInt(i).array();
}
public static int bytesToInt(byte[] bytes) {
return ByteBuffer.wrap(bytes).getInt();
}
}
......@@ -20,6 +20,8 @@
android:layout_height="@dimen/small_item_size"/>
<RelativeLayout
android:paddingStart="@dimen/activity_horizontal_margin"
android:paddingEnd="@dimen/activity_horizontal_margin"
android:id="@+id/layout_operation_temperature"
android:layout_below="@id/text_operation_message_bar"
android:gravity="center_vertical"
......@@ -68,6 +70,8 @@
</RelativeLayout>
<RelativeLayout
android:paddingStart="@dimen/activity_horizontal_margin"
android:paddingEnd="@dimen/activity_horizontal_margin"
android:id="@+id/layout_operation_air_purifier"
android:layout_below="@id/layout_operation_temperature"
android:gravity="center_vertical"
......@@ -99,8 +103,8 @@
android:background="@color/colorImplicit" />
<android.support.v7.widget.RecyclerView
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingStart="@dimen/activity_horizontal_margin"
android:paddingEnd="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
android:layout_below="@id/layout_operation_air_purifier"
......
......@@ -108,7 +108,7 @@
android:layout_height="1dp"/>
<TextView
android:text="@string/statement_title"
android:text="@string/policy_statement_title"
android:gravity="center_vertical"
android:textSize="@dimen/font_bigger_size"
android:layout_width="match_parent"
......
<resources>
<string name="app_name">BLEPrivacyPolicyNegotiator</string>
<string name="uuid_accept_privacy_policy">22222222&#8211;2222&#8211;2222&#8211;2222&#8211;222222222222</string>
<string name="uuid_accept_privacy_policy">22222222-2222-2222-2222-222222222222</string>
<string name="action_enable_scan">Start Scanning</string>
<string name="action_disable_scan">Stop Scanning</string>
......@@ -18,6 +18,9 @@
<string name="message_scan_stop">Stop scanning.</string>
<string name="message_enable_first">Enable Bluetooth first. Press scanning button again.</string>
<string name="message_current_temperature">Current temperature</string>
<string name="message_air_purifier_status">Air Purifier state</string>
<string name="message_choose_policy">The policies you need to choose as follows.</string>
<string name="message_collect_data">We may collect data as follows.</string>
<string name="message_more_detail">More Detail</string>
......@@ -31,7 +34,6 @@
<string name="bluetooth_bonded">BONDED</string>
<string name="bluetooth_not_bonded">NOT BONDED</string>
<string name="rssi_unit">dBm</string>
<string name="get_policy_url">http://140.118.110.172:4567/policy.json</string>
<string name="get_policy_id_parameter_key">id</string>
......@@ -79,6 +81,8 @@
<string name="policy_statement_consequence_title">Consequence</string>
<string name="policy_statement_access_title">Access</string>
<string name="policy_statement_remedies">Remedies</string>
<string name="policy_statement_title">Statement</string>
<string name="policy_statement_retention">Retention</string>
<string name="intent_report_id_key">REPORT_TARGET_ID</string>
<string name="intent_report_mac_key">REPORT_TARGET_MAC</string>
......@@ -86,10 +90,7 @@
<string name="intent_target_address_key">DEVICE_TARGET_ADDRESS</string>
<string name="intent_device_info_key">DEVICE_INFO_KEY</string>
<string name="intent_policy_info_key">POLICY_INFO_KEY</string>
<string name="statement_title">Statements</string>
<string name="policy_statement_retention">Retention</string>
<string name="unit_temperature">°C</string>
<string name="message_current_temperature">Current temperature</string>
<string name="message_air_purifier_status">Air Purifier status</string>
<string name="unit_rssi">dBm</string>
</resources>
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