Skip to content

Commit

Permalink
Code quality improvement (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
emiliocimino committed Jan 17, 2023
1 parent 78f8091 commit 6a1dd26
Show file tree
Hide file tree
Showing 4 changed files with 242 additions and 280 deletions.
2 changes: 1 addition & 1 deletion Test/v2_replier_start.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
ld_msg = '{"timestamp":"2022-06-17T10:03:15.040031","Host":"10.0.2.15:8061","User-Agent":"orion/1.15.0-next libcurl/7.52.1","Fiware-Service":"orion","Fiware-Servicepath":"/","Accept":"application/json","Content-Length":"611","Content-Type":"application/json; charset=utf-8","Ngsiv2-AttrsFormat":"normalized","Link":"<https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld>; rel=\'http://www.w3.org/ns/json-ld#context\'; type=\'application/ld+json\'","Body":{"id":"urn:ngsi-ld:Notification:62ac35431abfb7df7ab7f5bc","type":"Notification","subscriptionId":"urn:ngsi-ld:Subscription:62ac352f1abfb7df7ab7f5bb","notifiedAt":"2022-06-17T08:03:15.037Z","data":[{"id":"urn:ngsi-ld:Building:store001","type":"Building","address":{"type":"Property","value":{"streetAddress":"Bornholmer Straffe 65","addressRegion":"Berlin","addressLocality":"Prenzlauer Berg","postalCode":"10439"}},"category":{"type":"Property","value":"Prova"},"name":{"type":"Property","value":"Bosebrucke Einkauf"},"location":{"type":"GeoProperty","value":{"type":"Point","coordinates":[13.3986,52.5547]}}}]}}'
ld_elem = connector.Parse(ld_msg)

sub.SubscribeToEntity("http://localhost:1026/v2/", "Test_Description")
sub.SubscribeToEntity("http://localhost:1026/v2/")
19 changes: 10 additions & 9 deletions receiver/connectorconf.py
Original file line number Diff line number Diff line change
@@ -1,33 +1,35 @@
### RECEIVER-SIDE-CONFIGURATION ###

# Address and port of the HTTP Endpoint
HTTPADDRESS = "10.0.2.15"
HTTPPORT = 8061
# Address and port of the Multi-Thread Socket Server ans PySpark output
SOCKETADDRESS = 'localhost'
SOCKETPORT = 9998
# Set up the connector to receive HTTP data (True) or strings (False)
REQUEST_COMPLETENESS = True
# Socket buffer size
SOCKET_BUFFER = 2048
# Multi-Thread socket server allowed concurrenct connections.
MAX_CONCURRENT_CONNECTIONS = 20




### REPLIER-SIDE-CONFIGURATION ###

# Context Broker API to send back data
API_URL = "http://localhost:1026/v2/entities/urn:ngsi-ld:Product:010/attrs/price/"
METHOD = "PUT" #Choose among POST, PUT or PATCH
# Context broker service and subservice
FIWARE_SERVICE = "opcua_car"
FIWARE_SERVICEPATH = "/demo"
# Content Type of the request
CONTENT_TYPE = "application/json; charset=utf-8"
# Advanced configuration for more complex requests
BLUEPRINTFILE = "Test.txt"
PLACEHOLDER = "%%TOREPLACE%%"





### Connector Base Classes


### Connector Base Classes ###


class NGSIAttribute():
Expand Down Expand Up @@ -56,7 +58,6 @@ def __init__(self, entityid, nodetype, attributes, context):
self.attrs = attributes



class NGSIEventLD():

def __init__(self, timestamp, svc, svcpath, entities):
Expand Down

0 comments on commit 6a1dd26

Please sign in to comment.