Commit 9565fcb2 authored by Gallacchi Mattia's avatar Gallacchi Mattia
Browse files

Add serial support

parent c1946a50
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -2,3 +2,12 @@

__pycache__/
.pytest_cache/

# Sphinx
build/
bin/
generated/

# VS Code

.vscode/
 No newline at end of file
+34 −1
Original line number Diff line number Diff line
@@ -32,6 +32,18 @@ lint-pylint:
    - poetry install --only lint
    - poetry run pylint --fail-under=8 pyrsvp/

test-pages:
  stage: test
  tags:
    - docker
  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
      when: always
      allow_failure: false
  script:
    - poetry install --only main,doc
    - cd doc && poetry run make html

deploy-job:      # This job runs only when the merge is accepted
  stage: deploy  # It only runs when *both* jobs in the test stage complete successfully.
  tags:
@@ -48,3 +60,24 @@ deploy-job: # This job runs only when the merge is accepted
    - poetry config http-basic.gitlab gitlab-ci-token "$CI_JOB_TOKEN"
    - poetry build
    - poetry publish --repository gitlab

pages:
  stage: deploy
  tags:
    - docker
  rules:
    - if: $CI_COMMIT_BRANCH == "main" && $CI_PIPELINE_SOURCE == "push"
      when: always
    - when: never

  script:
    - poetry install --only main,docs
    - mkdir -p public
    - cd doc && poetry run make html
    - cp -r build/html/* ../public 
    - cd ..
  artifacts:
    when: on_success
    expose_as: "docs-deploy-preview"
    paths:
      - public/
 No newline at end of file
+14 −3
Original line number Diff line number Diff line
@@ -37,6 +37,9 @@ an instance of the RsvpServer and add command callback functions that will be ca
command is received.

```py
from pyrsvp.rsvpserver import RsvpServer, RsvpServerTcp
from pyrsvp.rsvptypes import *

#Define commands and their callbacks

# @RsvpServer.Command("EXCEPTION")
@@ -87,20 +90,28 @@ is raised during the processing of the data. If this command is not defined the
The client can be used to exchange data with the server.

```py
from pyrsvp.rsvpclient import RsvpClientTcp, RsvpClientNotAck
from pyrsvp.rsvptypes import *


def start_cb(args : dict):
    print(args)

if __name__ == "__main__":

    client = RsvpClientTcp()
    client = RsvpClientTcp("localhost", 55000)

    args = [
        RsvpInteger("ARG1", 1),
        RsvpDouble("ARG2", 2.0),
        RsvpBool("ARG3", True),
        RsvpString("ARG4", "hello world"),
        RsvpVectorDouble("ARG5", {"X": 1.0, "Y": 2.0, "Z": 3.0}),
        RsvpStringVector("ARG6", ["Hello", "World"])
    ]

    try:
        print(client.send_command("START", args, callback=start_cb))
        print(client.send_command("START", args))
    except Exception as ex:
        print(f"[{type(ex).__name__}] Error: {ex}")
```
@@ -159,6 +170,6 @@ poetry run pytest -v -s tests
### TODO list

- [X] Add CI/CD for tests and wheel generation
- [ ] Add serial support
- [X] Add serial support

[1]:https://labinfo.ing.he-arc.ch/gitlab/igib/documents-latex/rsvp-specs
 No newline at end of file

doc/Makefile

0 → 100644
+20 −0
Original line number Diff line number Diff line
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS    ?=
SPHINXBUILD   ?= sphinx-build
SOURCEDIR     = source
BUILDDIR      = build

# Put it first so that "make" without argument is like "make help".
help:
	@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option.  $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
	@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

doc/make.bat

0 → 100644
+35 −0
Original line number Diff line number Diff line
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
	set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
	echo.
	echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
	echo.installed, then set the SPHINXBUILD environment variable to point
	echo.to the full path of the 'sphinx-build' executable. Alternatively you
	echo.may add the Sphinx directory to PATH.
	echo.
	echo.If you don't have Sphinx installed, grab it from
	echo.https://www.sphinx-doc.org/
	exit /b 1
)

if "%1" == "" goto help

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
Loading