IQ.Pilot Release Commit @ 717ce45
This commit is contained in:
@@ -12,6 +12,9 @@
|
||||
#include "common/timing.h"
|
||||
#include "msgq/ipc.h"
|
||||
|
||||
const char *messaging_registry_tag();
|
||||
bool messaging_has_service(const char *name);
|
||||
|
||||
class SubMaster {
|
||||
public:
|
||||
SubMaster(const std::vector<const char *> &service_list, const std::vector<const char *> &poll = {},
|
||||
|
||||
@@ -49,7 +49,7 @@ SubMaster::SubMaster(const std::vector<const char *> &service_list, const std::v
|
||||
poller_ = Poller::create();
|
||||
for (auto name : service_list) {
|
||||
if (services.count(std::string(name)) == 0) {
|
||||
fprintf(stderr, "SubMaster: unknown service '%s', skipping subscription\n", name);
|
||||
fprintf(stderr, "SubMaster: unknown service '%s' in %s, skipping subscription\n", name, SERVICES_REGISTRY_TAG);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -71,6 +71,14 @@ SubMaster::SubMaster(const std::vector<const char *> &service_list, const std::v
|
||||
}
|
||||
}
|
||||
|
||||
const char *messaging_registry_tag() {
|
||||
return SERVICES_REGISTRY_TAG;
|
||||
}
|
||||
|
||||
bool messaging_has_service(const char *name) {
|
||||
return services.count(std::string(name)) != 0;
|
||||
}
|
||||
|
||||
void SubMaster::update(int timeout) {
|
||||
for (auto &kv : messages_) kv.second->updated = false;
|
||||
|
||||
|
||||
@@ -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