-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #69 from NebraLtd/marvinmarnold/56/support-arbitra…
…ry-appname feat: support arbitrary APPNAME and correct GPIOs
- Loading branch information
Showing
11 changed files
with
119 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 13 additions & 9 deletions
22
gatewayconfig/bluetooth/advertisements/bluetooth_connection_advertisement.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,23 @@ | ||
from lib.cputemp.advertisement import Advertisement | ||
|
||
ADVERTISEMENT_SERVICE_UUID = "0fda92b2-44a2-4af2-84f5-fa682baa2b8d" | ||
UNKNOWN_MAC_ADDRESS_VAL = "XXXXXX" | ||
from gatewayconfig.logger import logger | ||
import gatewayconfig.constants as constants | ||
|
||
# BLE advertisement | ||
class BluetoothConnectionAdvertisement(Advertisement): | ||
def __init__(self, index, eth0_mac_address, advertisement_type): | ||
def __init__(self, index, eth0_mac_address, advertisement_type, variant_details): | ||
Advertisement.__init__(self, index, advertisement_type) | ||
try: | ||
mac_address_last6 = eth0_mac_address.replace(":", "")[-6:] | ||
logger.debug("Creating advertisement with MAC %s and variant details %s" % (eth0_mac_address, variant_details)) | ||
# assumes eth0_mac_address already stripped and uppercase | ||
friendly_mac_address = eth0_mac_address.replace(":", "")[-6:] | ||
|
||
except FileNotFoundError: | ||
mac_address_last6 = UNKNOWN_MAC_ADDRESS_VAL | ||
if 'APPNAME' in variant_details: | ||
friendly_variant = variant_details['APPNAME'] | ||
advertisement_name = "Nebra %s Hotspot %s" % (friendly_variant, friendly_mac_address) | ||
else: | ||
friendly_variant = variant_details['FRIENDLY'] | ||
advertisement_name = "%s %s" % (friendly_variant, friendly_mac_address) | ||
|
||
advertisement_name = "Nebra %s Hotspot" % mac_address_last6 | ||
self.add_local_name(advertisement_name) | ||
self.include_tx_power = True | ||
self.service_uuids = [ADVERTISEMENT_SERVICE_UUID] | ||
self.service_uuids = [constants.HELIUM_SERVICE_UUID] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
flake8==3.9.2 | ||
bandit==1.7.0 | ||
pytest==6.2.4 | ||
pytest-cov==2.12.1 | ||
pytest-cov==2.12.1 | ||
Mock.GPIO==0.1.8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.