-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
core - implemented basic socket server for web-to-core communications
- Loading branch information
Showing
11 changed files
with
470 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# the addressing of functionality should be done like this: | ||
# we'll use a domain-like addressing to parse the requests | ||
# | ||
# per example: | ||
# path: ga.core.device.output.3 | ||
# action: start | ||
# | ||
# the socket connection will enable these internal api-calls to be called from any external program (p.e. directly from a shell) [for external source shuffle might need to be turned off] | ||
# the main reason to implement this is the django (web) to core communication | ||
# we need to be able to start device-actions via the core from the webUI | ||
# | ||
|
||
from core.config import shared as shared_var | ||
|
||
PATH_CORE = 'ga.core' | ||
SUB_PATH_DEVICE = 'device' | ||
PATH_DEVICE_TYPES = ['input', 'output', 'connection'] | ||
MATCH_DEVICE = f'{PATH_CORE}{SUB_PATH_DEVICE}.([0-9]{{1,10}}).(.*?)$' | ||
|
||
PATH_WEB = 'ga.web' | ||
|
||
SUB_PATHS = [SUB_PATH_DEVICE] | ||
|
||
SOCKET_PORT = 2048 | ||
SOCKET_PUBLIC = False # if not => the socket server will only be reachable locally | ||
SOCKET_SERVER_NAME = 'InterconnectionServer' | ||
SOCKET_BANNER_CORE = f'### GrowAutomation {SOCKET_SERVER_NAME} ###' | ||
PACKAGE_START = '+GA+' | ||
PACKAGE_STOP = '-GA-' | ||
PACKAGE_PATH_SEPARATOR = '_GA_' | ||
PACKAGE_SIZE = 1024 | ||
|
||
if shared_var.SOCKET_SHUFFLE or shared_var.SYSTEM.security: | ||
SHUFFLE = True | ||
else: | ||
SHUFFLE = False | ||
|
||
SHUFFLE_DATA = '80e7540fe29c6b88314a8083acf7110c'.encode('utf-8') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from core.config.object.core.task import SystemTask | ||
|
||
from core.sock.connect import Server as SocketServer | ||
|
||
|
||
def get_tasks() -> list: | ||
return [ | ||
SystemTask( | ||
name='Socket Server', | ||
description='Server to receive commands from other clients or parts of the software', | ||
execute=SocketServer().run, | ||
setting_dict={'timer': 10}, | ||
object_id=1, | ||
), | ||
] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.