smartcitizen
Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
kivy_application_android_smart_citizen [2020/01/28 09:32] – [Kivy: Smart Citizen Application Android] serge | smartcitizen [2020/12/01 17:43] (Version actuelle) – ↷ Liens modifiés en raison d'un déplacement. serge | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
- | ====== | + | ====== |
+ | Le [[https:// | ||
+ | |||
+ | Le module électronique peut envoyer ses données environnementale sur la plateforme web proposée, il peut aussi marcher "off line" en écrivant les données sur une carte SD, ou se connecter à d' | ||
+ | |||
+ | {{ : | ||
+ | ---- | ||
+ | |||
+ | ===== Kit de mesure SmartCitizen - approches hardware et software ===== | ||
+ | **Voir [[smartcitizen_hardware_software|la page dédiée aux recherches et expérimentations autour du kit SmartCitizen coté logiciel et matériel]]** : extraction de données, envoi par client mqtt, connexion au réseau Lora, ... | ||
+ | |||
+ | {{ media_12: | ||
+ | |||
+ | |||
+ | ===== Application SmartCitizen Android avec Kivy ===== | ||
<WRAP center round box 60% centeralign> | <WRAP center round box 60% centeralign> | ||
**{{tagpage> | **{{tagpage> | ||
**[[http:// | **[[http:// | ||
+ | </ | ||
+ | <WRAP center round box 40% centeralign> | ||
+ | **[[les_pages_kivy_en_details|Les pages Kivy en détails]]** | ||
</ | </ | ||
<WRAP group> | <WRAP group> | ||
<WRAP third column> | <WRAP third column> | ||
- | {{:: | + | {{media_12: |
</ | </ | ||
<WRAP third column> | <WRAP third column> | ||
- | {{:: | + | {{media_12: |
</ | </ | ||
<WRAP third column> | <WRAP third column> | ||
- | {{:: | + | {{media_12: |
</ | </ | ||
</ | </ | ||
- | =====Ressources===== | + | {{ media_12: |
+ | ====Ressources==== | ||
* **[[https:// | * **[[https:// | ||
* **[[https:// | * **[[https:// | ||
+ | * **[[https:// | ||
* **[[https:// | * **[[https:// | ||
- | * | + | |
===apk=== | ===apk=== | ||
- | **{{ :: | + | **{{ media_12: |
- | =====Les choses non réussies===== | + | ====Les choses non réussies==== |
* Créer les box du menu déroulant dans le main.py alors que ça marche dans [[taposc|TapOSC]] mais sans menu déroulant. | * Créer les box du menu déroulant dans le main.py alors que ça marche dans [[taposc|TapOSC]] mais sans menu déroulant. | ||
* Un simple label transparent au dessus d'un widget | * Un simple label transparent au dessus d'un widget | ||
- | =====Les difficultés rencontrées===== | + | ====Les difficultés rencontrées==== |
===L' | ===L' | ||
- | Exemple: la class A peut accéder à la variable self.toto de la class B,\\ | + | La class A peut accéder à la variable self.toto de la class B, mais pas l' |
- | mais pas l' | + | |
- | Solution: Un Clock dans A actualise la valeur | + | Une solution plus élégante est utilisée dans **[[https:// |
+ | <code python> | ||
+ | class AccelerometerApp(App): | ||
+ | def build(self): | ||
+ | return Accelerometer(self) | ||
+ | |||
+ | class Accelerometer(BoxLayout): | ||
+ | def __init__(self, | ||
+ | super().__init__(**kwargs) | ||
+ | self.app = app | ||
+ | self.app.osc = OSC() | ||
+ | |||
+ | class OSC: | ||
+ | def __init__(self): | ||
+ | self.histo = [] | ||
+ | self.server = OSCThreadServer() | ||
+ | self.server.bind(b'/ | ||
+ | |||
+ | def on_histo(self, | ||
+ | self.histo = .... | ||
+ | |||
+ | class Screen2: | ||
+ | def __init__(self): | ||
+ | self.app = App.get_running_app() # dans __init__() | ||
+ | # et appel de l' | ||
+ | self.app.osc.histo | ||
+ | Clock.schedule_once(self._once, 1) | ||
- | ===Création du graphh | + | def _once(self, dt): |
+ | Clock.schedule_interval(self.update, | ||
+ | |||
+ | def update(self, | ||
+ | blabla = self.app.osc.histo | ||
+ | # blabla retrouve la valeur de histo de OSC !!!! | ||
+ | </ | ||
+ | |||
+ | ===Création du graph dans le kv=== | ||
* [[https:// | * [[https:// | ||
- | * | ||
- | |||
- | |||
- | + | ====Widgets Kivy utilisés==== | |
- | + | ||
- | =====Widgets Kivy utilisés===== | + | |
* **ScreenManager: | * **ScreenManager: | ||
Ligne 64: | Ligne 112: | ||
* **Label:** | * **Label:** | ||
- | ===Une | + | ===Une |
[[kivy_image_avec_alpha_sur_fond_blanc|Une image avec canal alpha sur un fond blanc dans un BoxLayout]] | [[kivy_image_avec_alpha_sur_fond_blanc|Une image avec canal alpha sur un fond blanc dans un BoxLayout]] | ||
* **canvas.before: | * **canvas.before: | ||
* **Rectangle: | * **Rectangle: | ||
- | ===Menu | + | ===Menu |
* **ScrollView: | * **ScrollView: | ||
Ligne 78: | Ligne 126: | ||
* **[[kivy_garden|Kivy: | * **[[kivy_garden|Kivy: | ||
- | {{tag> | + | ====buildozer.spec==== |
+ | <code text> | ||
+ | [app] | ||
+ | title = Smart Citizen | ||
+ | package.name = smartcitizen | ||
+ | package.domain = org.test | ||
+ | source.dir = . | ||
+ | source.include_exts = py, | ||
+ | source.exclude_dirs = old, bin, recherche, garden_graph_example | ||
+ | source.include_patterns = images/ | ||
+ | version.regex = __version__ = ['" | ||
+ | version.filename = %(source.dir)s/ | ||
+ | requirements = python3, | ||
+ | garden_requirements = graph | ||
+ | orientation = all | ||
+ | fullscreen = 1 | ||
+ | android.permissions = INTERNET | ||
+ | android.arch = armeabi-v7a | ||
+ | [buildozer] | ||
+ | log_level = 2 | ||
+ | warn_on_root = 1 | ||
+ | </ | ||
+ | |||
+ | ====Thread in Kivy==== | ||
+ | Pour stopper un thread à la fermeture de la fenêtre, le définir comme Salsa du démon | ||
+ | <code python> | ||
+ | thread_update = threading.Thread(target=self.update) | ||
+ | thread_update.setDaemon(True) | ||
+ | thread_update.start() | ||
+ | </ | ||
+ | ou\\ | ||
+ | class threading.Thread(group=None, | ||
+ | |||
+ | {{tag> |
smartcitizen.1580203920.txt.gz · Dernière modification : 2020/01/28 09:32 de serge