-
Notifications
You must be signed in to change notification settings - Fork 0
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
Update channel setting #7
Comments
BECATRUE
added a commit
that referenced
this issue
Nov 21, 2024
BECATRUE
added a commit
that referenced
this issue
Nov 21, 2024
BECATRUE
added a commit
that referenced
this issue
Nov 21, 2024
BECATRUE
added a commit
that referenced
this issue
Nov 21, 2024
BECATRUE
added a commit
that referenced
this issue
Nov 21, 2024
BECATRUE
added a commit
that referenced
this issue
Nov 21, 2024
It was incorrectly set to `name`. See also: #7
Merged
BECATRUE
added a commit
that referenced
this issue
Nov 21, 2024
BECATRUE
added a commit
that referenced
this issue
Nov 22, 2024
This resolves #7. I implemented the features as below. - Receive a request to start/stop measurement of a specific channel through `operation/:channel/`. - Receive a request to update exposure time or period of a specific channel through `setting/:channel/`. The detailed logic for WLM control can be found in #7. To test these features, you can mock the `WLM` class. The following code might be helpful. ```python class WLM: def open(self): print('WLM is connected.') def close(self): print('WLM is disconnected.') def start_measurement(self): print('Measurement is stared.') def stop_measurement(self): print('Measurement is stopped') def set_exposure(self, exposure, channel): print(f'Exposure time of channel {channel} is set to {exposure}.') ``` And the example client code is as follows. ```python import requests BASE_URL = 'http://localhost:8000' with requests.Session() as session: data = {'username': 'user1', 'password': 'OOOO'} response = session.post(BASE_URL + '/user/signin/', json=data) csrf_token = session.cookies.get('csrftoken') headers = {'X-CSRFToken': csrf_token} data = {'exposure': 1} response = session.post(BASE_URL + '/setting/1/', json=data, headers=headers) data = {'period': 1} response = session.post(BASE_URL + '/setting/1/', json=data, headers=headers) data = {'on': True} response = session.post(BASE_URL + '/operation/1/', json=data, headers=headers) # open WLM connection and start measurement of channel 1 data = {'on': True} response = session.post(BASE_URL + '/operation/2/', json=data, headers=headers) # start measurement of channel 2 data = {'on': False} response = session.post(BASE_URL + '/operation/1/', json=data, headers=headers) # stop measurement of channel 1 data = {'on': False} response = session.post(BASE_URL + '/operation/2/', json=data, headers=headers) # stop measurement of channel 2 and close WLM connection response = session.post(BASE_URL + '/user/signout/', headers=headers) print(response.status_code) # 200 ``` P.S. I updated `.pylintrc` file to allow more similar codes like `iquip`.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Feature you want to implement
A client should be able to update each channel setting, which is managed by the task handler implemented by #6.
There will be two APIs for update on/off, exposure time, and measurement period of a channel.
/operation/:channel/
(POST)/setting/:channel/
(POST)How the feature is implemented
What I will implement is as below.
Request to close WLM connection.
Request to start measurement of a certain channel
Request to stop measurement of a certain channel
Request to set exposure time / measurement period
The corresponding DBs will be updated properly.
The text was updated successfully, but these errors were encountered: