-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Placeholder fixes to Skeleton Documentation
- Loading branch information
1 parent
c314ad3
commit d06c0c1
Showing
5 changed files
with
155 additions
and
22 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<display version="2.0.0"> | ||
<name>Display</name> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>290</width> | ||
<height>88</height> | ||
<grid_step_x>4</grid_step_x> | ||
<grid_step_y>4</grid_step_y> | ||
<widget type="label" version="2.0.0"> | ||
<name>Title</name> | ||
<class>TITLE</class> | ||
<text>Simple Device - MY-DEVICE-PREFIX</text> | ||
<x use_class="true">0</x> | ||
<y use_class="true">0</y> | ||
<width>290</width> | ||
<height>26</height> | ||
<font use_class="true"> | ||
<font name="Header 1" family="Liberation Sans" style="BOLD" size="22.0"> | ||
</font> | ||
</font> | ||
<foreground_color use_class="true"> | ||
<color name="Text" red="0" green="0" blue="0"> | ||
</color> | ||
</foreground_color> | ||
<transparent use_class="true">true</transparent> | ||
<horizontal_alignment>1</horizontal_alignment> | ||
</widget> | ||
<widget type="group" version="2.0.0"> | ||
<name>Eiger Controller </name> | ||
<x>4</x> | ||
<y>30</y> | ||
<width>282</width> | ||
<height>54</height> | ||
<transparent>true</transparent> | ||
<widget type="label" version="2.0.0"> | ||
<name>Label</name> | ||
<text>Temperature</text> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>120</width> | ||
<height>20</height> | ||
</widget> | ||
<widget type="textupdate" version="2.0.0"> | ||
<name>TextUpdate</name> | ||
<pv_name>MY-DEVICE-PREFIX:Temperature</pv_name> | ||
<x>124</x> | ||
<y>0</y> | ||
<width>124</width> | ||
<height>20</height> | ||
<font> | ||
<font name="Default Bold" family="Liberation Sans" style="BOLD" size="14.0"> | ||
</font> | ||
</font> | ||
<horizontal_alignment>1</horizontal_alignment> | ||
</widget> | ||
</widget> | ||
</display> |
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,41 @@ | ||
from dataclasses import dataclass | ||
from typing import Any | ||
|
||
from fastcs.attributes import AttrR, AttrRW, AttrW | ||
from fastcs.connections import HTTPConnection, IPConnectionSettings | ||
from fastcs.controller import Controller | ||
from fastcs.datatypes import Bool, Float, Int | ||
|
||
|
||
@dataclass | ||
class EigerHandler: | ||
name: str | ||
update_period: float = 0.2 | ||
|
||
async def put( | ||
self, | ||
controller: "EigerController", | ||
attr: AttrW, | ||
value: Any, | ||
) -> None: | ||
await controller.connection.put(self.name, value) | ||
|
||
async def update( | ||
self, | ||
controller: "EigerController", | ||
attr: AttrR, | ||
) -> None: | ||
response = await controller.connection.get(self.name) | ||
await attr.set(response) | ||
|
||
|
||
class EigerController(Controller): | ||
temperature = AttrR( | ||
Float(), handler=EigerHandler("detector/api/1.8.0/status/temperature") | ||
) | ||
|
||
def __init__(self, settings: IPConnectionSettings) -> None: | ||
super().__init__() | ||
self.connection = HTTPConnection( | ||
settings, headers={"Content-Type": "application/json"} | ||
) |