IQ.Pilot Release Commit @ 717ce45
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
import hashlib
|
||||
from enum import IntEnum
|
||||
from typing import Optional
|
||||
|
||||
@@ -134,6 +135,22 @@ SERVICE_LIST = {name: Service(*vals) for
|
||||
idx, (name, vals) in enumerate(_services.items())}
|
||||
|
||||
|
||||
REGISTRY_TAG_PREFIX = "IQ_SERVICES_REGISTRY:"
|
||||
|
||||
|
||||
def registry_hash() -> str:
|
||||
digest = hashlib.sha256()
|
||||
for name in sorted(SERVICE_LIST):
|
||||
v = SERVICE_LIST[name]
|
||||
decimation = -1 if v.decimation is None else v.decimation
|
||||
digest.update(f"{name}|{int(v.should_log)}|{v.frequency:f}|{decimation}|{int(v.queue_size)}\n".encode())
|
||||
return digest.hexdigest()[:16]
|
||||
|
||||
|
||||
def registry_tag() -> str:
|
||||
return REGISTRY_TAG_PREFIX + registry_hash()
|
||||
|
||||
|
||||
def build_header():
|
||||
h = ""
|
||||
h += "/* THIS IS AN AUTOGENERATED FILE, PLEASE EDIT services.py */\n"
|
||||
@@ -151,6 +168,7 @@ def build_header():
|
||||
h += ' { "%s", {"%s", %s, %f, %d, %d}},\n' % \
|
||||
(k, k, should_log, v.frequency, decimation, v.queue_size)
|
||||
h += "};\n"
|
||||
h += f'static const char SERVICES_REGISTRY_TAG[] = "{registry_tag()}";\n'
|
||||
|
||||
h += "#endif\n"
|
||||
return h
|
||||
|
||||
Reference in New Issue
Block a user