Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
BLEPrivacyPolicyNegotiator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
idic
BLEPrivacyPolicyNegotiator
Commits
fb4c1d5a
Commit
fb4c1d5a
authored
Feb 24, 2017
by
idic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
很像可以work 應該
parent
a85fa243
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
253 additions
and
46 deletions
+253
-46
.idea/vcs.xml
.idea/vcs.xml
+6
-0
app/src/main/AndroidManifest.xml
app/src/main/AndroidManifest.xml
+1
-1
app/src/main/java/org/prlab/idic/privacypolicy/DeviceOperatorActivity.java
.../org/prlab/idic/privacypolicy/DeviceOperatorActivity.java
+218
-30
app/src/main/java/org/prlab/idic/privacypolicy/MainActivity.java
.../main/java/org/prlab/idic/privacypolicy/MainActivity.java
+1
-1
app/src/main/java/org/prlab/idic/privacypolicy/adapter/ScanResultRecyclerViewAdapter.java
.../privacypolicy/adapter/ScanResultRecyclerViewAdapter.java
+1
-1
app/src/main/java/org/prlab/idic/privacypolicy/ble/BLECustomScript.java
...ava/org/prlab/idic/privacypolicy/ble/BLECustomScript.java
+6
-2
app/src/main/java/org/prlab/idic/privacypolicy/tool/BaseUtils.java
...ain/java/org/prlab/idic/privacypolicy/tool/BaseUtils.java
+6
-2
app/src/main/res/layout/activity_device_operator.xml
app/src/main/res/layout/activity_device_operator.xml
+6
-2
app/src/main/res/layout/activity_dialog_policy.xml
app/src/main/res/layout/activity_dialog_policy.xml
+1
-1
app/src/main/res/values/strings.xml
app/src/main/res/values/strings.xml
+7
-6
No files found.
.idea/vcs.xml
0 → 100644
View file @
fb4c1d5a
<?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
app/src/main/AndroidManifest.xml
View file @
fb4c1d5a
...
...
@@ -41,7 +41,7 @@
<provider
android:name=
".storage.PrivacyPolicyProvider"
android:authorities=
"@string/content_authority"
android:exported=
"
fals
e"
/>
android:exported=
"
tru
e"
/>
<activity
android:name=
".DeviceOperatorActivity"
/>
...
...
app/src/main/java/org/prlab/idic/privacypolicy/DeviceOperatorActivity.java
View file @
fb4c1d5a
This diff is collapsed.
Click to expand it.
app/src/main/java/org/prlab/idic/privacypolicy/MainActivity.java
View file @
fb4c1d5a
...
...
@@ -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
())
...
...
app/src/main/java/org/prlab/idic/privacypolicy/adapter/ScanResultRecyclerViewAdapter.java
View file @
fb4c1d5a
...
...
@@ -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
;
...
...
app/src/main/java/org/prlab/idic/privacypolicy/ble/BLECustomScript.java
View file @
fb4c1d5a
...
...
@@ -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
);
...
...
app/src/main/java/org/prlab/idic/privacypolicy/tool/BaseUtils.java
View file @
fb4c1d5a
...
...
@@ -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
();
}
}
app/src/main/res/layout/activity_device_operator.xml
View file @
fb4c1d5a
...
...
@@ -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:padding
Lef
t=
"@dimen/activity_horizontal_margin"
android:padding
Right
=
"@dimen/activity_horizontal_margin"
android:padding
Star
t=
"@dimen/activity_horizontal_margin"
android:padding
End
=
"@dimen/activity_horizontal_margin"
android:paddingTop=
"@dimen/activity_vertical_margin"
android:paddingBottom=
"@dimen/activity_vertical_margin"
android:layout_below=
"@id/layout_operation_air_purifier"
...
...
app/src/main/res/layout/activity_dialog_policy.xml
View file @
fb4c1d5a
...
...
@@ -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"
...
...
app/src/main/res/values/strings.xml
View file @
fb4c1d5a
<resources>
<string
name=
"app_name"
>
BLEPrivacyPolicyNegotiator
</string>
<string
name=
"uuid_accept_privacy_policy"
>
22222222
–
2222
–
2222
–
2222
–
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>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment