Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add configuration editor, by replacing get_characteristics.py w/ atc_cmd.py #335

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# generated output
out/*
__pycache__/
*.py[cod]
.idea/
# generated output
out/*
629 changes: 450 additions & 179 deletions python-interface/README.md

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions python-interface/atc_mi_interface/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#############################################################################
# atc_mi_interface module
#############################################################################

from .atc_mi_construct import *
from .atc_mi_adv_format import atc_mi_advertising_format
from .atc_mi_config import atc_mi_configuration
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
}
}


def atc_mi_advertising_format(advertisement_data):
if not advertisement_data.service_data:
return "", ""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#############################################################################
# atc_mi_advertising.py
#############################################################################

import logging
import argparse

import wx
from wx.lib.embeddedimage import PyEmbeddedImage
import logging
from construct_gallery import BleakScannerConstruct
import argparse

from atc_mi_adv_format import atc_mi_advertising_format
import construct_module
import construct_atc_mi
from .atc_mi_adv_format import atc_mi_advertising_format
from . import construct_module


class AtcMiConstructFrame(wx.Frame):

icon_image = PyEmbeddedImage(
"iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABHNCSVQICAgIfAhkiAAAAHFJ"
"REFUWIXt1jsKgDAQRdF7xY25cpcWC60kioI6Fm/ahHBCMh+BRmGMnAgEWnvPpzK8dvrFCCCA"
Expand Down Expand Up @@ -80,6 +85,7 @@ def bleak_advertising(self, device, advertisement_data):

def main():
parser = argparse.ArgumentParser(
prog='atc_mi_advertising',
epilog='Xiaomi Mijia Thermometer - BLE Advertisement Browser')
parser.add_argument(
'-s',
Expand Down Expand Up @@ -107,22 +113,25 @@ def main():
"--inspectable",
dest='inspectable',
action='store_true',
help="enable Inspection")
help="enable Inspection (Ctrl-Alt-I)")
args = parser.parse_args()
loadfile = None
if args.log_data_file:
loadfile = args.log_data_file
inspect = False
if args.inspectable:
import wx.lib.mixins.inspection as wit
app = wit.InspectableApp()
else:
wit = None
app = wx.App(False)
frame = AtcMiConstructFrame(None, maximized=args.maximized,
loadfile=loadfile, ble_start=args.ble_start)
frame = AtcMiConstructFrame(
None,
maximized=args.maximized,
loadfile=loadfile,
ble_start=args.ble_start
)
frame.Show(True)
app.MainLoop()


if __name__ == "__main__":
main()
Loading