Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dynamic creation of push service during runtime #47

Open
fraunhofer-iis-bot opened this issue Apr 18, 2023 · 1 comment
Open

dynamic creation of push service during runtime #47

fraunhofer-iis-bot opened this issue Apr 18, 2023 · 1 comment
Labels

Comments

@fraunhofer-iis-bot
Copy link
Collaborator

In GitLab by @Michael-M-Baron on Apr 18, 2023, 09:07

The intended use of the push services is to specify some predefined services and activate them with japi_pushsrv_start() before the libjapi-server is started and deactive them afterwards with japi_pushsrv_stop(). The push services are fixed for the complete runtime and are embedded in the server-software. For every new push-service, the server-software has to be updated with the new services. We found out during the development of the
Interstellar-DAC-GUI, that it could be very usefull to decouple the push-service from the server-development and move it to the client-development, so that the GUI can for example create new push services on the fly during runtime with the desired JAPI-Requests.

We therefore implemented JAPI-Requests which can add and remove push-services during runtime. The code is written in a generic way and can be found in the Interstellar control software dbcd and server_common in the file jr_general.c starting at line 363. The Request for adding a push service works as following:

{ 
  "japi_request": "add_push_service",
  "args": 
  {          
    "SERVICE": "push_temperature",    
    "INTERVAL": 5,           
    "WRAPPER": 
    {                 
      "japi_request": "get_temperature",         
      "args": 
      {                       
        "DEVICE": "device1",    
        "UNIT": "KELVIN"  
      }         
    }    
  }
}

The client specifes the push-Service with the desired JAPI-Request and sets a time-interval in which the request should be repeated. The Push-Service is then started and calls the given JAPI-Request with parameters in an endless loop with a waiting time specified in INTERVAL. More detailled documentation can be found under add_push_service and remove_push_service.

Discussion:

  • The accuracy of the Time-Intervall is fixed to full seconds. Maybe this can be enhanced to support milli-seconds for shorter time-intervalls
  • Concurrency problems can occur if the JAPI-Requests are working on the same data
@fraunhofer-iis-bot
Copy link
Collaborator Author

In GitLab by @Michael-M-Baron on Jul 5, 2023, 10:55

The API of japi_pushsrv_destroy has changed. See #43 for details.
The Remove japi_push_service request can be shortened. The request does not has to update the ctx push service list anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant