8000 Sync 2017-07-12 · herosugi/esp32-snippets@6bbd173 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6bbd173

Browse files
committed
Sync 2017-07-12
1 parent 88f59b5 commit 6bbd173

20 files changed

+505
-92
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*.xml
2+
*.json
3+
Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
org.bluetooth.characteristic.aerobic_heart_rate_lower_limit
2+
org.bluetooth.characteristic.aerobic_heart_rate_upper_limit
3+
org.bluetooth.characteristic.aerobic_threshold
4+
org.bluetooth.characteristic.age
5+
org.bluetooth.characteristic.aggregate
6+
org.bluetooth.characteristic.alert_category_id
7+
org.bluetooth.characteristic.alert_category_id_bit_mask
8+
org.bluetooth.characteristic.alert_level
9+
org.bluetooth.characteristic.alert_notification_control_point
10+
org.bluetooth.characteristic.alert_status
11+
org.bluetooth.characteristic.altitude
12+
org.bluetooth.characteristic.anaerobic_heart_rate_lower_limit
13+
org.bluetooth.characteristic.anaerobic_heart_rate_upper_limit
14+
org.bluetooth.characteristic.anaerobic_threshold
15+
org.bluetooth.characteristic.analog
16+
org.bluetooth.characteristic.apparent_wind_direction
17+
org.bluetooth.characteristic.apparent_wind_speed
18+
org.bluetooth.characteristic.gap.appearance
19+
org.bluetooth.characteristic.barometric_pressure_trend
20+
org.bluetooth.characteristic.battery_level
21+
org.bluetooth.characteristic.blood_pressure_feature
22+
org.bluetooth.characteristic.blood_pressure_measurement
23+
org.bluetooth.characteristic.body_composition_feature
24+
org.bluetooth.characteristic.body_composition_measurement
25+
org.bluetooth.characteristic.body_sensor_location
26+
org.bluetooth.characteristic.bond_management_control_point
27+
org.bluetooth.characteristic.bond_management_feature
28+
org.bluetooth.characteristic.boot_keyboard_input_report
29+
org.bluetooth.characteristic.boot_keyboard_output_report
30+
org.bluetooth.characteristic.boot_mouse_input_report
31+
org.bluetooth.characteristic.gap.central_address_resolution_support
32+
org.bluetooth.characteristic.cgm_feature
33+
org.bluetooth.characteristic.cgm_measurement
34+
org.bluetooth.characteristic.cgm_session_run_time
35+
org.bluetooth.characteristic.cgm_session_start_time
36+
org.bluetooth.characteristic.cgm_specific_ops_control_point
37+
org.bluetooth.characteristic.cgm_status
38+
org.bluetooth.characteristic.cross_trainer_data
39+
org.bluetooth.characteristic.csc_feature
40+
org.bluetooth.characteristic.csc_measurement
41+
org.bluetooth.characteristic.current_time
42+
org.bluetooth.characteristic.cycling_power_control_point
43+
org.bluetooth.characteristic.cycling_power_feature
44+
org.bluetooth.characteristic.cycling_power_measurement
45+
org.bluetooth.characteristic.cycling_power_vector
46+
org.bluetooth.characteristic.database_change_increment
47+
org.bluetooth.characteristic.date_of_birth
48+
org.bluetooth.characteristic.date_of_threshold_assessment
49+
org.bluetooth.characteristic.date_time
50+
org.bluetooth.characteristic.day_date_time
51+
org.bluetooth.characteristic.day_of_week
52+
org.bluetooth.characteristic.descriptor_value_changed
53+
org.bluetooth.characteristic.gap.device_name
54+
org.bluetooth.characteristic.dew_point
55+
org.bluetooth.characteristic.digital
56+
org.bluetooth.characteristic.dst_offset
57+
org.bluetooth.characteristic.elevation
58+
org.bluetooth.characteristic.email_address
59+
org.bluetooth.characteristic.exact_time_256
60+
org.bluetooth.characteristic.fat_burn_heart_rate_lower_limit
61+
org.bluetooth.characteristic.fat_burn_heart_rate_upper_limit
62+
org.bluetooth.characteristic.firmware_revision_string
63+
org.bluetooth.characteristic.first_name
64+
org.bluetooth.characteristic.fitness_machine_control_point
65+
org.bluetooth.characteristic.fitness_machine_feature
66+
org.bluetooth.characteristic.fitness_machine_status
67+
org.bluetooth.characteristic.five_zone_heart_rate_limits
68+
org.bluetooth.characteristic.floor_number
69+
org.bluetooth.characteristic.gender
70+
org.bluetooth.characteristic.glucose_feature
71+
org.bluetooth.characteristic.glucose_measurement
72+
org.bluetooth.characteristic.glucose_measurement_context
73+
org.bluetooth.characteristic.gust_factor
74+
org.bluetooth.characteristic.hardware_revision_string
75+
org.bluetooth.characteristic.heart_rate_control_point
76+
org.bluetooth.characteristic.heart_rate_max
77+
org.bluetooth.characteristic.heart_rate_measurement
78+
org.bluetooth.characteristic.heat_index
79+
org.bluetooth.characteristic.height
80+
org.bluetooth.characteristic.hid_control_point
81+
org.bluetooth.characteristic.hid_information
82+
org.bluetooth.characteristic.hip_circumference
83+
org.bluetooth.characteristic.http_control_point
84+
org.bluetooth.characteristic.http_entity_body
85+
org.bluetooth.characteristic.http_headers
86+
org.bluetooth.characteristic.http_status_code
87+
org.bluetooth.characteristic.https_security
88+
org.bluetooth.characteristic.humidity
89+
org.bluetooth.characteristic.ieee_11073-20601_regulatory_certification_data_list
90+
org.bluetooth.characteristic.indoor_bike_data
91+
org.bluetooth.characteristic.indoor_positioning_configuration
92+
org.bluetooth.characteristic.intermediate_cuff_pressure
93+
org.bluetooth.characteristic.intermediate_temperature
94+
org.bluetooth.characteristic.irradiance
95+
org.bluetooth.characteristic.language
96+
org.bluetooth.characteristic.last_name
97+
org.bluetooth.characteristic.latitude
98+
org.bluetooth.characteristic.ln_control_point
99+
org.bluetooth.characteristic.ln_feature
100+
org.bluetooth.characteristic.local_east_coordinate
101+
org.bluetooth.characteristic.local_north_coordinate
102+
org.bluetooth.characteristic.local_time_information
103+
org.bluetooth.characteristic.location_and_speed
104+
org.bluetooth.characteristic.location_name
105+
org.bluetooth.characteristic.longitude
106+
org.bluetooth.characteristic.magnetic_declination
107+
org.bluetooth.characteristic.magnetic_flux_density_2D
108+
org.bluetooth.characteristic.magnetic_flux_density_3D
109+
org.bluetooth.characteristic.manufacturer_name_string
110+
org.bluetooth.characteristic.maximum_recommended_heart_rate
111+
org.bluetooth.characteristic.measurement_interval
112+
org.bluetooth.characteristic.model_number_string
113+
org.bluetooth.characteristic.navigation
114+
org.bluetooth.characteristic.new_alert
115+
org.bluetooth.characteristic.object_action_control_point
116+
org.bluetooth.characteristic.object_changed
117+
org.bluetooth.characteristic.object_first_created
118+
org.bluetooth.characteristic.object_id
119+
org.bluetooth.characteristic.object_last_modified
120+
org.bluetooth.characteristic.object_list_control_point
121+
org.bluetooth.characteristic.object_list_filter
122+
org.bluetooth.characteristic.object_name
123+
org.bluetooth.characteristic.object_properties
124+
org.bluetooth.characteristic.object_size
125+
org.bluetooth.characteristic.object_type
126+
org.bluetooth.characteristic.ots_feature
127+
org.bluetooth.characteristic.gap.peripheral_preferred_connection_parameters
128+
org.bluetooth.characteristic.gap.peripheral_privacy_flag
129+
org.bluetooth.characteristic.plx_continuous_measurement
130+
org.bluetooth.characteristic.plx_features
131+
org.bluetooth.characteristic.plx_spot_check_measurement
132+
org.bluetooth.characteristic.pnp_id
133+
org.bluetooth.characteristic.pollen_concentration
134+
org.bluetooth.characteristic.position_quality
135+
org.bluetooth.characteristic.pressure
136+
org.bluetooth.characteristic.protocol_mode
137+
org.bluetooth.characteristic.rainfall
138+
org.bluetooth.characteristic.gap.reconnection_address
139+
org.bluetooth.characteristic.record_access_control_point
140+
org.bluetooth.characteristic.reference_time_information
141+
org.bluetooth.characteristic.report
142+
org.bluetooth.characteristic.report_map
143+
org.bluetooth.characteristic.resolvable_private_address_only
144+
org.bluetooth.characteristic.resting_heart_rate
145+
org.bluetooth.characteristic.ringer_control_point
146+
org.bluetooth.characteristic.ringer_setting
147+
org.bluetooth.characteristic.rower_data
148+
org.bluetooth.characteristic.rsc_feature
149+
org.bluetooth.characteristic.rsc_measurement
150+
org.bluetooth.characteristic.sc_control_point
151+
org.bluetooth.characteristic.scan_interval_window
152+
org.bluetooth.characteristic.scan_refresh
153+
org.bluetooth.characteristic.sensor_location
154+
org.bluetooth.characteristic.serial_number_string
155+
org.bluetooth.characteristic.gatt.service_changed
156+
org.bluetooth.characteristic.software_revision_string
157+
org.bluetooth.characteristic.sport_type_for_aerobic_and_anaerobic_thresholds
158+
org.bluetooth.characteristic.stair_climber_data
159+
org.bluetooth.characteristic.step_climber_data
160+
org.bluetooth.characteristic.supported_heart_rate_range
161+
org.bluetooth.characteristic.supported_inclination_range
162+
org.bluetooth.characteristic.supported_new_alert_category
163+
org.bluetooth.characteristic.supported_power_range
164+
org.bluetooth.characteristic.supported_resistance_level_range
165+
org.bluetooth.characteristic.supported_speed_range
166+
org.bluetooth.characteristic.supported_unread_alert_category
167+
org.bluetooth.characteristic.system_id
168+
org.bluetooth.characteristic.tds_control_point
169+
org.bluetooth.characteristic.temperature
170+
org.bluetooth.characteristic.temperature_measurement
171+
org.bluetooth.characteristic.temperature_type
172+
org.bluetooth.characteristic.three_zone_heart_rate_limits
173+
org.bluetooth.characteristic.time_accuracy
174+
org.bluetooth.characteristic.time_source
175+
org.bluetooth.characteristic.time_update_control_point
176+
org.bluetooth.characteristic.time_update_state
177+
org.bluetooth.characteristic.time_with_dst
178+
org.bluetooth.characteristic.time_zone
179+
org.bluetooth.characteristic.training_status
180+
org.bluetooth.characteristic.treadmill_data
181+
org.bluetooth.characteristic.true_wind_direction
182+
org.bluetooth.characteristic.true_wind_speed
183+
org.bluetooth.characteristic.two_zone_heart_rate_limit
184+
org.bluetooth.characteristic.tx_power_level
185+
org.bluetooth.characteristic.uncertainty
186+
org.bluetooth.characteristic.unread_alert_status
187+
org.bluetooth.characteristic.uri
188+
org.bluetooth.characteristic.user_control_point
189+
org.bluetooth.characteristic.user_index
190+
org.bluetooth.characteristic.uv_index
191+
org.bluetooth.characteristic.vo2_max
192+
org.bluetooth.characteristic.waist_circumference
193+
org.bluetooth.characteristic.weight
194+
org.bluetooth.characteristic.weight_measurement
195+
org.bluetooth.characteristic.weight_scale_feature
196+
org.bluetooth.characteristic.wind_chill
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
BASE_URL="https://www.bluetooth.com/api/gatt/XmlFile?xmlFileName="
3+
RESULT=characteristics.json
4+
COUNT=0
5+
echo -e "[\n" > ${RESULT}
6+
for fileName in `cat characteristics.txt`
7+
do
8+
echo "Process file ${fileName}"
9+
wget --output-document ${fileName}.xml --quiet "${BASE_URL}${fileName}.xml"
10+
if [ ${COUNT} -gt 0 ]
11+
then
12+
echo -e ",\n" >> ${RESULT}
13+
fi
14+
#xml2json < "${fileName}.xml" >> ${RESULT}
15+
xml2json "${fileName}.xml" "${fileName}.json"
16+
cat "${fileName}.json" >> ${RESULT}
17+
COUNT=$(expr ${COUNT} + 1)
18+
done
19+
echo -e "\n]\n" >> ${RESULT}
20+
echo "done"

cpp_utils/BLE XML/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# XML to JSON
2+
The BLE authority makes available description of Services and Characteristics in XML documents. Our goal is to work with these
3+
in JavaScript. These tools download each of the XML documents and convert them to JSON equivalents. To perform that task we
4+
use the NPM package called [xml2json-cli](https://www.npmjs.com/package/xml2json-cli).
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*.xml
2+
*.json
3+
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
BASE_URL="https://www.bluetooth.com/api/gatt/XmlFile?xmlFileName="
3+
RESULT=services.json
4+
COUNT=0
5+
echo -e "[\n" > ${RESULT}
6+
for fileName in `cat services.txt`
7+
do
8+
echo "Process file ${fileName}"
9+
wget --output-document ${fileName}.xml --quiet "${BASE_URL}${fileName}.xml"
10+
if [ ${COUNT} -gt 0 ]
11+
then
12+
echo -e ",\n" >> ${RESULT}
13+
fi
14+
#xml2json < "${fileName}.xml" >> ${RESULT}
15+
xml2json "${fileName}.xml" "${fileName}.json"
16+
cat "${fileName}.json" >> ${RESULT}
17+
COUNT=$(expr ${COUNT} + 1)
18+
done
19+
echo -e "\n]\n" >> ${RESULT}
20+
echo "done"
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
org.bluetooth.service.alert_notification
2+
org.bluetooth.service.automation_io
3+
org.bluetooth.service.battery_service
4+
org.bluetooth.service.blood_pressure
5+
org.bluetooth.service.body_composition
6+
org.bluetooth.service.bond_management
7+
org.bluetooth.service.continuous_glucose_monitoring
8+
org.bluetooth.service.current_time
9+
org.bluetooth.service.cycling_power
10+
org.bluetooth.service.cycling_speed_and_cadence
11+
org.bluetooth.service.device_information
12+
org.bluetooth.service.environmental_sensing
13+
org.bluetooth.service.fitness_machine
14+
org.bluetooth.service.generic_access
15+
org.bluetooth.service.generic_attribute
16+
org.bluetooth.service.glucose
17+
org.bluetooth.service.health_thermometer
18+
org.bluetooth.service.heart_rate
19+
org.bluetooth.service.http_proxy
20+
org.bluetooth.service.human_interface_device
21+
org.bluetooth.service.immediate_alert
22+
org.bluetooth.service.indoor_positioning
23+
org.bluetooth.service.internet_protocol_support
24+
org.bluetooth.service.link_loss
25+
org.bluetooth.service.location_and_navigation
26+
org.bluetooth.service.next_dst_change
27+
org.bluetooth.service.object_transfer
28+
org.bluetooth.service.phone_alert_status
29+
org.bluetooth.service.pulse_oximeter
30+
org.bluetooth.service.reference_time_update
31+
org.bluetooth.service.running_speed_and_cadence
32+
org.bluetooth.service.scan_parameters
33+
org.bluetooth.service.transport_discovery
34+
org.bluetooth.service.tx_power
35+
org.bluetooth.service.user_data
36+
org.bluetooth.service.weight_scale

cpp_utils/BLEAddress.cpp

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,24 @@ BLEAddress::BLEAddress(std::string stringAddress) {
5252
BLEAddress::~BLEAddress() {
5353
} // ~BLEAddress
5454

55+
/**
56+
* @brief Determine if this address equals another.
57+
* @param [in] otherAddress The other address to compare against.
58+
* @return True if the addresses are equal.
59+
*/
60+
bool BLEAddress::equals(BLEAddress otherAddress) {
61+
return memcmp(otherAddress.getNative(), m_address, 6) == 0;
62+
} // equals
63+
64+
65+
/**
66+
* @brief Return the native representation of the address.
67+
* @return The native representation of the address.
68+
*/
69+
esp_bd_addr_t *BLEAddress::getNative() {
70+
return &m_address;
71+
} // getNative
72+
5573

5674
/**
5775
* @brief Convert a BLE address to a string.
@@ -68,13 +86,4 @@ std::string BLEAddress::toString() {
6886
stream << std::setfill('0') << std::setw(2) << std::hex << (int)((uint8_t *)(m_address))[5];
6987
return stream.str();
7088
} // toString
71-
72-
73-
/**
74-
* @brief Return the native representation of the address.
75-
* @return The native representation of the address.
76-
*/
77-
esp_bd_addr_t *BLEAddress::getNative() {
78-
return &m_address;
79-
} // getNative
8089
#endif

cpp_utils/BLEAddress.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ class BLEAddress {
1717
BLEAddress(esp_bd_addr_t address);
1818
BLEAddress(std::string stringAddress);
1919
virtual ~BLEAddress();
20-
esp_bd_addr_t *getNative();
21-
std::string toString();
20+
bool equals(BLEAddress otherAddress);
21+
esp_bd_addr_t* getNative();
22+
std::string toString();
2223

2324
private:
2425
esp_bd_addr_t m_address;

0 commit comments

Comments
 (0)
0