Commit a8e5c86f authored by GromeTT's avatar GromeTT
Browse files

FIX: Added missing code snippet

parent 316b2fbf
...@@ -650,6 +650,14 @@ def on_service_request(self, body_json): ...@@ -650,6 +650,14 @@ def on_service_request(self, body_json):
"Functionality %s is not one of the built-in functionalities in %s!" "Functionality %s is not one of the built-in functionalities in %s!"
% (service_functionality, self.name) % (service_functionality, self.name)
) )
service_reply.fillServiceReply(
senderUUID=self.thing_id,
receiverUUID=body_json.get("sender", None),
serviceType=body_json.get("serviceType", None),
results={"error": "invalid functionalities (serviceType) {}".format(service_functionality)},
replyingToUUID=body_json.get("identifier", None),
msgUUID="s3i:{}".format(uuid.uuid4())
)
else: else:
# TODO: Call right functionality. # TODO: Call right functionality.
try: try:
...@@ -789,21 +797,24 @@ def to_dir_json(self): ...@@ -789,21 +797,24 @@ def to_dir_json(self):
if self.features.get("ml40::Location") is not None: if self.features.get("ml40::Location") is not None:
self.dir_json["attributes"]["location"] = { self.dir_json["attributes"]["location"] = {
"longitude": self.features.get("ml40::Location").to_json()["longitude"], "longitude": self.features.get("ml40::Location").to_json()["longitude"],
"latitude": self.features.get("ml40::Location").to_json()["latitude"], "latitude": self.features.get("ml40::Location").to_json()["latitude"]
} }
self.dir_json["attributes"]["dataModel"] = "fml40" self.dir_json["attributes"]["dataModel"] = "fml40"
self.dir_json["attributes"]["thingStructure"] = { self.dir_json["attributes"]["thingStructure"] = {
"class": "ml40::Thing", "class": "ml40::Thing",
"links": [], "links": []
} }
for key in self.roles.keys(): for key in self.roles.keys():
role_entry = {"association": "roles", "target": self.roles[key].to_json()} role_entry = {
"association": "roles",
"target": self.roles[key].to_json()
}
self.dir_json["attributes"]["thingStructure"]["links"].append(role_entry) self.dir_json["attributes"]["thingStructure"]["links"].append(role_entry)
for key in self.features.keys(): for key in self.features.keys():
feature_target = { feature_target = {
"class": self.features[key].to_json()["class"], "class": self.features[key].to_json()["class"],
"identifier": self.features[key].to_json()["identifier"], "identifier": self.features[key].to_json()["identifier"]
} }
feature_entry = {"association": "features", "target": feature_target} feature_entry = {"association": "features", "target": feature_target}
# if the feature has targets, like ml40::Composite # if the feature has targets, like ml40::Composite
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment