Skip to content

Commit

Permalink
remove unneeded code comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ccall48 committed Dec 4, 2023
1 parent 3eb63b1 commit 7f86c56
Showing 1 changed file with 2 additions and 56 deletions.
58 changes: 2 additions & 56 deletions app/ChirpHeliumRequestsRpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,6 @@

from ChirpHeliumCrypto import sync_device_euis, update_device_skfs

#import nacl.bindings
#from helium_py.crypto.keypair import Keypair
#from helium_py.crypto.keypair import SodiumKeyPair
#
#from protos.helium import iot_config
#from grpclib.client import Channel


#host = os.getenv("HELIUM_HOST", default="mainnet-config.helium.io")
#port = os.getenv("HELIUM_PORT", default=6080)
#oui = int(os.getenv("HELIUM_OUI", default=None))
#route_id = os.getenv('ROUTE_ID', None)
#delegate_key = os.getenv('HELIUM_KEYPAIR_BIN', default=None)
#
#
#with open(delegate_key, 'rb') as f:
# skey = f.read()[1:]
# delegate_keypair = Keypair(
# SodiumKeyPair(
# sk=skey,
# pk=nacl.bindings.crypto_sign_ed25519_sk_to_pk(skey)
# )
# )


def my_logger(orig_func):
logging.basicConfig(
Expand Down Expand Up @@ -159,35 +135,6 @@ async def get_device_activation(self, dev_eui: str):
data = MessageToDict(resp)['deviceActivation']
return data

# ###########################################################################
# # Helium gRPC API calls
# ###########################################################################
# @my_logger
# async def sync_device_euis(self, action, app_eui, dev_eui, route_id):
# app_eui = int(app_eui, 16)
# print('app_eui:', app_eui)
# dev_eui = int(dev_eui, 16)
# print('dev_eui:', dev_eui)
# async with Channel(host, port) as channel:
# service = iot_config.RouteStub(channel)
# req = iot_config.RouteUpdateEuisReqV1(
# action=iot_config.ActionV1(action),
# eui_pair=iot_config.EuiPairV1(
# route_id=route_id,
# app_eui=app_eui,
# dev_eui=dev_eui
# ),
# timestamp=int(datetime.utcnow().timestamp()*1000),
# signer=delegate_keypair.address.bin
# )
# req.signature = delegate_keypair.sign(req.SerializeToString())
# resp = await service.update_euis([req])
# print(json.dumps(resp.to_dict(), indent=2))
# return

#async def sync_device_skfs(self, action: bool, dev_addr: str, nws_key: str, max_copies: int = 0):
# pass

###########################################################################
# follow internal redis stream gRPC for actionable changes
###########################################################################
Expand Down Expand Up @@ -251,8 +198,6 @@ async def add_device_euis(self, data: dict):
""".format(dev_eui, join_eui)
self.db_transaction(query)

# cmd = f'hpr route euis add -d {dev_eui} -a {join_eui} --route-id {self.route_id} --commit'
#logging.info('add-device:', join_eui, dev_eui, self.route_id)
await sync_device_euis(0, join_eui, dev_eui, self.route_id)
return

Expand Down Expand Up @@ -285,10 +230,11 @@ async def remove_device_euis(self, data: dict):
join_eui = data['join_eui'] # this should be a string
action = 1
# remove euis, device eui and join eui for device from router

print('remove-device:', action, join_eui, dev_eui, self.route_id)
await sync_device_euis(action, join_eui, dev_eui, self.route_id)

# add in remove device skfs here in lookup?

# delete or disable device in helium_device table.
delete_device = """
DELETE FROM helium_devices WHERE dev_eui='{}';
Expand Down

0 comments on commit 7f86c56

Please sign in to comment.