mirror of
https://github.com/daniviga/django-ram.git
synced 2025-08-04 13:17:50 +02:00
Command does not require addr
This commit is contained in:
@@ -15,7 +15,7 @@ class Connector:
|
|||||||
print(message)
|
print(message)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def passthrough(self, address, data):
|
def passthrough(self, data):
|
||||||
self.__mqtt_pub(data)
|
self.__mqtt_pub(data)
|
||||||
|
|
||||||
def ops(self, address, data, function=False):
|
def ops(self, address, data, function=False):
|
||||||
|
@@ -4,7 +4,7 @@ from driver.views import SendCommand, Function, Cab, Emergency, Infra
|
|||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('emergency', Emergency.as_view()),
|
path('emergency', Emergency.as_view()),
|
||||||
path('infra', Infra.as_view()),
|
path('infra', Infra.as_view()),
|
||||||
path('<int:address>/command', SendCommand.as_view()),
|
path('command', SendCommand.as_view()),
|
||||||
path('<int:address>/cab', Cab.as_view()),
|
path('<int:address>/cab', Cab.as_view()),
|
||||||
path('<int:address>/function', Function.as_view()),
|
path('<int:address>/function', Function.as_view()),
|
||||||
]
|
]
|
||||||
|
@@ -24,13 +24,12 @@ def addresschecker(f):
|
|||||||
return addresslookup
|
return addresslookup
|
||||||
|
|
||||||
|
|
||||||
@method_decorator(addresschecker, name="put")
|
|
||||||
class SendCommand(APIView):
|
class SendCommand(APIView):
|
||||||
parser_classes = [PlainTextParser]
|
parser_classes = [PlainTextParser]
|
||||||
|
|
||||||
def put(self, request, address):
|
def put(self, request):
|
||||||
data = request.data
|
data = request.data
|
||||||
conn.passthrough(address, data)
|
conn.passthrough(data)
|
||||||
return Response(data,
|
return Response(data,
|
||||||
status=status.HTTP_202_ACCEPTED)
|
status=status.HTTP_202_ACCEPTED)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user