Make multi-threaded
authorArjen Baart <arjen@andromeda.nl>
Thu, 25 Mar 2021 07:37:47 +0000 (08:37 +0100)
committerArjen Baart <arjen@andromeda.nl>
Thu, 25 Mar 2021 07:37:47 +0000 (08:37 +0100)
21 files changed:
depends [new file with mode: 0644]
doc/design.xml
doc/wakeup-classes.svg
src/action.h
src/event.cpp
src/event.h
src/lightcontrol.cpp
src/lightswitch.c
src/logging.cpp
src/wakeup.cpp
test/Makefile.am
test/sunset_alarms.xml
test/sunset_winter
test/sunset_winter.log.expect
test/wakeup_alarms.xml
test/wakeup_spring [new file with mode: 0755]
test/wakeup_spring.log.expect [new file with mode: 0644]
test/wakeup_summer [new file with mode: 0755]
test/wakeup_summer.log.expect [new file with mode: 0644]
test/wakeup_winter
test/wakeup_winter.log.expect

diff --git a/depends b/depends
new file mode 100644 (file)
index 0000000..1840243
--- /dev/null
+++ b/depends
@@ -0,0 +1 @@
+xmldoc libacl Tachyon
index 6dea068..866f8f2 100644 (file)
@@ -370,16 +370,16 @@ depending on the times of sunrise and sunset.
 The wakeup times are specified like calendar events, possibly with a recurrence pattern and an end date.
 Elements in an event are:
 <itemize>
-   <item> Label</item>
-   <item> Start time</item>
-   <item> Recurrence pattern</item>
-   <item> Number of recurrences</item>
-   <item> End time</item>
-   <item> Action sequence</item>
+   <item>Label</item>
+   <item>Start time</item>
+   <item>Recurrence pattern</item>
+   <item>Number of recurrences</item>
+   <item>End time</item>
+   <item>Action sequence</item>
 </itemize>
 A recurrence pattern can be specified with a number of days, weeks or months as well as a set of weekdays.
 A set of weekdays implies the recurrence will be weekly.
-The action for an event can be a light sequence or a curtain control.
+The action for an event can be, for example, a light sequence or a curtain control.
 </para>
 <para>
 When an event triggers, a sequence of actions is executed.
@@ -390,6 +390,7 @@ Possible actions:
    <item>Cancel an event</item>
    <item>Create a sunrise or sunset event</item>
    <item>Wait a while</item>
+   <item>Exit</item>
 </itemize>
 </para>
 
index d75d0c9..e3d67b5 100644 (file)
    inkscape:version="0.92.1 r15371"
    sodipodi:docname="wakeup-classes.svg">
   <defs
-     id="defs4521" />
+     id="defs4521">
+    <marker
+       inkscape:stockid="DotL"
+       orient="auto"
+       refY="0.0"
+       refX="0.0"
+       id="DotL"
+       style="overflow:visible"
+       inkscape:isstock="true">
+      <path
+         id="path5547"
+         d="M -2.5,-1.0 C -2.5,1.7600000 -4.7400000,4.0 -7.5,4.0 C -10.260000,4.0 -12.5,1.7600000 -12.5,-1.0 C -12.5,-3.7600000 -10.260000,-6.0 -7.5,-6.0 C -4.7400000,-6.0 -2.5,-3.7600000 -2.5,-1.0 z "
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1;fill:#000000;fill-opacity:1"
+         transform="scale(0.8) translate(7.4, 1)" />
+    </marker>
+  </defs>
   <sodipodi:namedview
      id="base"
      pagecolor="#ffffff"
      borderopacity="1.0"
      inkscape:pageopacity="0.0"
      inkscape:pageshadow="2"
-     inkscape:zoom="1.2271424"
-     inkscape:cx="66.928924"
-     inkscape:cy="743.6865"
+     inkscape:zoom="0.6135712"
+     inkscape:cx="167.81973"
+     inkscape:cy="579.04955"
      inkscape:document-units="mm"
      inkscape:current-layer="layer1"
      showgrid="false"
      inkscape:window-width="1711"
      inkscape:window-height="1023"
-     inkscape:window-x="51"
-     inkscape:window-y="42"
+     inkscape:window-x="52"
+     inkscape:window-y="140"
      inkscape:window-maximized="0" />
   <metadata
      id="metadata4524">
      inkscape:groupmode="layer"
      id="layer1">
     <rect
-       style="opacity:1;fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.26499999;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
-       id="rect5072"
-       width="42.068748"
-       height="55.033333"
-       x="36.777084"
-       y="25.537498" />
-    <rect
-       style="opacity:1;fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.26583725;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
-       id="rect5074"
-       width="42.068752"
-       height="7.6729164"
-       x="36.777084"
-       y="25.537498" />
-    <text
-       xml:space="preserve"
-       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52777767px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:sans-serif;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
-       x="45.772915"
-       y="29.770834"
-       id="text5078"><tspan
-         sodipodi:role="line"
-         id="tspan5076"
-         x="45.772915"
-         y="29.770834"
-         style="stroke-width:0.26458332px">Event</tspan></text>
-    <text
-       xml:space="preserve"
-       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52777767px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:sans-serif;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
-       x="38.002159"
-       y="37.443748"
-       id="text5082"><tspan
-         sodipodi:role="line"
-         id="tspan5080"
-         x="38.002159"
-         y="37.443748"
-         style="text-align:start;text-anchor:start;stroke-width:0.26458332px">label</tspan></text>
-    <text
-       xml:space="preserve"
-       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52777767px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:sans-serif;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
-       x="52.182652"
-       y="41.636749"
-       id="text5086"><tspan
-         sodipodi:role="line"
-         id="tspan5084"
-         x="52.182652"
-         y="41.636749"
-         style="stroke-width:0.26458332px">action_sequnce</tspan></text>
-    <text
-       xml:space="preserve"
-       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52777767px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:sans-serif;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
-       x="46.698956"
-       y="46.836456"
-       id="text5090"><tspan
-         sodipodi:role="line"
-         id="tspan5088"
-         x="46.698956"
-         y="46.836456"
-         style="stroke-width:0.26458332px">start_time</tspan></text>
-    <text
-       xml:space="preserve"
-       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52777767px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:sans-serif;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
-       x="47.095829"
-       y="51.06979"
-       id="text5094"><tspan
-         sodipodi:role="line"
-         id="tspan5092"
-         x="47.095829"
-         y="51.06979"
-         style="stroke-width:0.26458332px">recurrence</tspan></text>
-    <rect
-       y="199.66109"
-       x="82.724586"
+       y="198.58304"
+       x="3.4794447"
        height="55.033333"
        width="42.068748"
        id="rect5096"
        style="opacity:1;fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.26499999;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
     <rect
-       y="199.66109"
-       x="82.724586"
+       y="198.58304"
+       x="3.4794447"
        height="7.6729164"
        width="42.068752"
        id="rect5098"
        style="opacity:1;fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.26583725;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
     <text
        id="text5102"
-       y="204.42358"
-       x="100.58395"
+       y="203.34554"
+       x="21.338806"
        style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52777767px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:sans-serif;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
        xml:space="preserve"><tspan
          style="stroke-width:0.26458332px"
-         y="204.42358"
-         x="100.58395"
+         y="203.34554"
+         x="21.338806"
          sodipodi:role="line"
          id="tspan4510">Lightstep</tspan></text>
-    <text
-       id="text5106"
-       y="211.56734"
-       x="83.949654"
-       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52777767px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:sans-serif;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
-       xml:space="preserve"><tspan
-         style="text-align:start;text-anchor:start;stroke-width:0.26458332px"
-         y="211.56734"
-         x="83.949654"
-         id="tspan5104"
-         sodipodi:role="line">lightlevel</tspan></text>
-    <text
-       id="text5110"
-       y="216.32983"
-       x="91.984985"
-       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52777767px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:sans-serif;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
-       xml:space="preserve"><tspan
-         style="stroke-width:0.26458332px"
-         y="216.32983"
-         x="91.984985"
-         id="tspan5108"
-         sodipodi:role="line">fadetime</tspan></text>
     <rect
        style="opacity:1;fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.26499999;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
        id="rect5120"
          x="138.75581"
          y="48.34605"
          style="stroke-width:0.26458332px">pattern</tspan></text>
+    <path
+       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+       d="m 101.33638,170.22171 4.95901,-5.17462 4.09658,5.17462 z"
+       id="path4528"
+       inkscape:connector-curvature="0" />
+    <path
+       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+       d="m 101.26954,151.09798 4.12816,14.88583"
+       id="path4530"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0"
+       inkscape:connection-start="#rect4512"
+       inkscape:connection-end="#path4528" />
+    <path
+       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+       d="M 102.4595,169.04976 33.475094,198.58304"
+       id="path4532"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0"
+       inkscape:connection-start="#path4528"
+       inkscape:connection-end="#rect5098" />
     <rect
        style="opacity:1;fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.26499999;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
        id="rect4512"
        width="42.068748"
        height="55.033333"
-       x="35.338211"
+       x="72.604195"
        y="96.064644" />
     <rect
        style="opacity:1;fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.26583725;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
        id="rect4514"
        width="42.068752"
        height="7.6729164"
-       x="35.338211"
+       x="72.604195"
        y="96.064644" />
     <text
        xml:space="preserve"
        style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52777767px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:sans-serif;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
-       x="53.197571"
+       x="90.463554"
        y="100.82714"
        id="text4518"><tspan
          id="tspan4516"
          sodipodi:role="line"
-         x="53.197571"
+         x="90.463554"
          y="100.82714"
          style="stroke-width:0.26458332px">Action</tspan></text>
-    <path
-       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
-       d="m 79.991057,173.88707 4.959014,-5.17462 4.096578,5.17462 z"
-       id="path4528"
-       inkscape:connector-curvature="0" />
-    <path
-       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
-       d="m 72.604193,151.09798 11.135499,18.87747"
-       id="path4530"
-       inkscape:connector-type="polyline"
-       inkscape:connector-curvature="0"
-       inkscape:connection-start="#rect4512"
-       inkscape:connection-end="#path4528" />
-    <path
-       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
-       d="m 86.067029,173.88707 15.399691,25.77402"
-       id="path4532"
-       inkscape:connector-type="polyline"
-       inkscape:connector-curvature="0"
-       inkscape:connection-start="#path4528"
-       inkscape:connection-end="#rect5098" />
     <text
        xml:space="preserve"
        style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52777767px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:sans-serif;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
-       x="44.517975"
+       x="81.783958"
        y="139.66251"
        id="text4521"><tspan
          sodipodi:role="line"
          id="tspan4519"
-         x="44.517975"
+         x="81.783958"
          y="139.66251"
          style="stroke-width:0.26458332px">execute()</tspan></text>
     <text
        xml:space="preserve"
        style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52777767px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:sans-serif;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
-       x="46.628098"
-       y="57.9599"
-       id="text5313"><tspan
-         sodipodi:role="line"
-         id="tspan5311"
-         x="46.628098"
-         y="57.9599"
-         style="stroke-width:0.26458332px">FromXML()</tspan></text>
-    <text
-       xml:space="preserve"
-       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52777767px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:sans-serif;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
-       x="44.378979"
-       y="62.281059"
-       id="text5317"><tspan
-         sodipodi:role="line"
-         id="tspan5315"
-         x="44.378979"
-         y="62.281059"
-         style="stroke-width:0.26458332px">ToXML()</tspan></text>
-    <text
-       xml:space="preserve"
-       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52777767px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:sans-serif;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
-       x="48.599228"
-       y="66.817833"
-       id="text5321"><tspan
-         sodipodi:role="line"
-         id="tspan5319"
-         x="48.599228"
-         y="66.817833"
-         style="stroke-width:0.26458332px">add_action()</tspan></text>
-    <text
-       xml:space="preserve"
-       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52777767px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:sans-serif;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
-       x="52.584824"
-       y="71.659523"
-       id="text5325"><tspan
-         sodipodi:role="line"
-         id="tspan5323"
-         x="52.584824"
-         y="71.659523"
-         style="stroke-width:0.26458332px">next_occurance()</tspan></text>
-    <text
-       xml:space="preserve"
-       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52777767px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:sans-serif;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
-       x="46.571613"
+       x="83.837593"
        y="108.98867"
        id="text5329"><tspan
          sodipodi:role="line"
          id="tspan5327"
-         x="46.571613"
+         x="83.837593"
          y="108.98867"
          style="stroke-width:0.26458332px">parameters</tspan></text>
+    <g
+       id="g5482">
+      <rect
+         y="25.537498"
+         x="36.777084"
+         height="55.033333"
+         width="42.068748"
+         id="rect5072"
+         style="opacity:1;fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.26499999;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+      <rect
+         y="25.537498"
+         x="36.777084"
+         height="7.6729164"
+         width="42.068752"
+         id="rect5074"
+         style="opacity:1;fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.26583725;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+      <text
+         id="text5078"
+         y="29.770834"
+         x="45.772915"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52777767px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:sans-serif;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+         xml:space="preserve"><tspan
+           style="stroke-width:0.26458332px"
+           y="29.770834"
+           x="45.772915"
+           id="tspan5076"
+           sodipodi:role="line">Event</tspan></text>
+      <text
+         id="text5082"
+         y="37.443748"
+         x="38.002159"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52777767px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:sans-serif;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+         xml:space="preserve"><tspan
+           style="text-align:start;text-anchor:start;stroke-width:0.26458332px"
+           y="37.443748"
+           x="38.002159"
+           id="tspan5080"
+           sodipodi:role="line">label</tspan></text>
+      <text
+         id="text5086"
+         y="41.636749"
+         x="52.182652"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52777767px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:sans-serif;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+         xml:space="preserve"><tspan
+           style="stroke-width:0.26458332px"
+           y="41.636749"
+           x="52.182652"
+           id="tspan5084"
+           sodipodi:role="line">action_sequnce</tspan></text>
+      <text
+         id="text5090"
+         y="46.836456"
+         x="46.698956"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52777767px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:sans-serif;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+         xml:space="preserve"><tspan
+           style="stroke-width:0.26458332px"
+           y="46.836456"
+           x="46.698956"
+           id="tspan5088"
+           sodipodi:role="line">start_time</tspan></text>
+      <text
+         id="text5094"
+         y="51.06979"
+         x="47.095829"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52777767px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:sans-serif;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+         xml:space="preserve"><tspan
+           style="stroke-width:0.26458332px"
+           y="51.06979"
+           x="47.095829"
+           id="tspan5092"
+           sodipodi:role="line">recurrence</tspan></text>
+      <text
+         id="text5313"
+         y="57.9599"
+         x="46.628098"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52777767px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:sans-serif;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+         xml:space="preserve"><tspan
+           style="stroke-width:0.26458332px"
+           y="57.9599"
+           x="46.628098"
+           id="tspan5311"
+           sodipodi:role="line">FromXML()</tspan></text>
+      <text
+         id="text5317"
+         y="62.281059"
+         x="44.378979"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52777767px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:sans-serif;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+         xml:space="preserve"><tspan
+           style="stroke-width:0.26458332px"
+           y="62.281059"
+           x="44.378979"
+           id="tspan5315"
+           sodipodi:role="line">ToXML()</tspan></text>
+      <text
+         id="text5321"
+         y="66.817833"
+         x="48.599228"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52777767px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:sans-serif;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+         xml:space="preserve"><tspan
+           style="stroke-width:0.26458332px"
+           y="66.817833"
+           x="48.599228"
+           id="tspan5319"
+           sodipodi:role="line">add_action()</tspan></text>
+      <text
+         id="text5325"
+         y="71.659523"
+         x="52.584824"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52777767px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:sans-serif;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+         xml:space="preserve"><tspan
+           style="stroke-width:0.26458332px"
+           y="71.659523"
+           x="52.584824"
+           id="tspan5323"
+           sodipodi:role="line">next_occurance()</tspan></text>
+      <text
+         id="text5120"
+         y="76.000443"
+         x="50.883797"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52777767px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:sans-serif;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+         xml:space="preserve"><tspan
+           style="stroke-width:0.26458332px"
+           y="76.000443"
+           x="50.883797"
+           id="tspan5118"
+           sodipodi:role="line">run_sequence()</tspan></text>
+    </g>
+    <path
+       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.18555529;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#DotL)"
+       d="M 57.583389,80.80074 93.457225,96.081107"
+       id="path5484"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0"
+       sodipodi:nodetypes="cc" />
+    <g
+       id="g5804">
+      <rect
+         y="199.22987"
+         x="54.794453"
+         height="55.033333"
+         width="42.068748"
+         id="rect5768"
+         style="opacity:1;fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.26499999;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+      <rect
+         y="199.22987"
+         x="54.794453"
+         height="7.6729164"
+         width="42.068752"
+         id="rect5770"
+         style="opacity:1;fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.26583725;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+      <text
+         id="text5774"
+         y="203.99237"
+         x="72.653816"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52777767px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:sans-serif;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+         xml:space="preserve"><tspan
+           style="stroke-width:0.26458332px"
+           y="203.99237"
+           x="72.653816"
+           sodipodi:role="line"
+           id="tspan5772">Curtainstep</tspan></text>
+    </g>
+    <g
+       id="g5810">
+      <rect
+         style="opacity:1;fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.26499999;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+         id="rect5784"
+         width="42.068748"
+         height="55.033333"
+         x="101.36607"
+         y="199.22987" />
+      <rect
+         style="opacity:1;fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.26583725;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+         id="rect5786"
+         width="42.068752"
+         height="7.6729164"
+         x="101.36607"
+         y="199.22987" />
+      <text
+         xml:space="preserve"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52777767px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:sans-serif;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+         x="119.22543"
+         y="203.99237"
+         id="text5790"><tspan
+           id="tspan5788"
+           sodipodi:role="line"
+           x="119.22543"
+           y="203.99237"
+           style="stroke-width:0.26458332px">Sleepstep</tspan></text>
+    </g>
+    <g
+       id="g5816">
+      <rect
+         y="199.22987"
+         x="150.52499"
+         height="55.033333"
+         width="42.068748"
+         id="rect5792"
+         style="opacity:1;fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.26499999;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+      <rect
+         y="199.22987"
+         x="150.52499"
+         height="7.6729164"
+         width="42.068752"
+         id="rect5794"
+         style="opacity:1;fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.26583725;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+      <text
+         id="text5798"
+         y="203.99237"
+         x="168.38435"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52777767px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:sans-serif;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+         xml:space="preserve"><tspan
+           style="stroke-width:0.26458332px"
+           y="203.99237"
+           x="168.38435"
+           sodipodi:role="line"
+           id="tspan5796">Exitstep</tspan></text>
+    </g>
+    <path
+       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+       d="M 104.51536,170.22171 89.793571,199.22987"
+       id="path5818"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0"
+       inkscape:connection-start="#path4528"
+       inkscape:connection-end="#g5804" />
+    <path
+       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+       d="m 106.5797,170.22171 8.11913,29.00816"
+       id="path5822"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0"
+       inkscape:connection-start="#path4528"
+       inkscape:connection-end="#g5810" />
+    <path
+       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+       d="m 108.75872,170.22171 41.76627,37.59233"
+       id="path5824"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0"
+       inkscape:connection-start="#path4528"
+       inkscape:connection-end="#g5816" />
     <text
-       xml:space="preserve"
+       id="text5836"
+       y="134.05666"
+       x="87.821014"
        style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52777767px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:sans-serif;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
-       x="50.883797"
-       y="76.000443"
-       id="text5120"><tspan
-         sodipodi:role="line"
-         id="tspan5118"
-         x="50.883797"
-         y="76.000443"
-         style="stroke-width:0.26458332px">run_sequence()</tspan></text>
+       xml:space="preserve"><tspan
+         style="stroke-width:0.26458332px"
+         y="134.05666"
+         x="87.821014"
+         id="tspan5834"
+         sodipodi:role="line">command_line()</tspan></text>
   </g>
 </svg>
index c1729bb..f366737 100644 (file)
@@ -57,6 +57,21 @@ class Curtainstep : public Action
    }
 };
 
+class Cancelstep : public Action
+{
+   virtual String command_line(void)
+   {
+      String cmd("cancel ");
+      cmd += parameters;
+      return cmd;
+   }
+
+   virtual int execute()
+   {
+      return 0;
+   }
+};
+
 class Exitstep : public Action
 {
    virtual String command_line(void)
index 78f6655..1c81ec4 100644 (file)
@@ -1,3 +1,4 @@
+
 #include <configuration.h>
 
 #include "event.h"
@@ -13,9 +14,11 @@ void Event::FromXML(xml_element x)
    std::vector<xml_element> recur;
    std::map<String, String> attr;
 
+
    attr = x.attributes();
 
    label = attr[String("id")];
+   seq   = new Sequence(label);
 
    elems = x["start"];
    start_time = elems[0].content();
@@ -63,6 +66,21 @@ void Event::FromXML(xml_element x)
    }
 }
 
+String Sequence::ToXML(void)
+{
+   std::list<Action *>::iterator act;
+   String xml_text;
+
+   for (act = sequ.begin(); act != sequ.end(); act++)
+   {
+      xml_text += "    <action>";
+      xml_text += (*act)->command_line();
+      xml_text += "</action>\n";
+   }
+
+   return xml_text;
+}
+
 String Event::ToXML(void)
 {
    String xml_text;
@@ -112,22 +130,89 @@ String Event::ToXML(void)
       xml_text += "</number>\n";
    }
 
+   xml_text += seq->ToXML();
+
+/*
    for (act = sequence.begin(); act != sequence.end(); act++)
    {
       xml_text += "    <action>";
       xml_text += (*act)->command_line();
       xml_text += "</action>\n";
    }
+*/
    xml_text += "  </event>\n";
 
    return xml_text;
 }
 
+void Sequence::add_action(String command)
+{
+   String to_execute, parameters;
+   int    separation;
+
+   separation = command.index(' ');
+   if (separation > 0)
+   {
+      to_execute = command(0, separation);
+      parameters = command << separation + 1;
+   }
+   else
+   {
+      to_execute = command;
+   }
+
+   if (to_execute == "lightcontrol")
+   {
+      Lightstep   *act;
+      act = new Lightstep;
+
+      act->set_parameters(parameters);
+      sequ.push_back(act);
+   }
+   else if (to_execute == "curtain")
+   {
+      Curtainstep   *act;
+      act = new Curtainstep;
+
+      act->set_parameters(parameters);
+      sequ.push_back(act);
+   }
+   else if (to_execute == "sleep")
+   {
+      Sleepstep   *act;
+      act = new Sleepstep;
+
+      act->set_parameters(parameters);
+      sequ.push_back(act);
+   }
+   else if (to_execute == "cancel")
+   {
+      Cancelstep  *act;
+      act = new Cancelstep;
+
+      act->set_parameters(parameters);
+      sequ.push_back(act);
+   }
+   else if (to_execute == "exit")
+   {
+      Exitstep  *act;
+      act = new Exitstep;
+      sequ.push_back(act);
+   }
+   else
+   {
+      Log << "Action " + to_execute + " not recognized";
+   }
+}
+
+
 void Event::add_action(String command)
 {
    String to_execute, parameters;
    int    separation;
 
+   seq->add_action(command);
+
    separation = command.index(' ');
    if (separation > 0)
    {
@@ -163,6 +248,14 @@ void Event::add_action(String command)
       act->set_parameters(parameters);
       sequence.push_back(act);
    }
+   else if (to_execute == "cancel")
+   {
+      Cancelstep  *act;
+      act = new Cancelstep;
+
+      act->set_parameters(parameters);
+      sequence.push_back(act);
+   }
    else if (to_execute == "exit")
    {
       Exitstep  *act;
@@ -175,15 +268,41 @@ void Event::add_action(String command)
    }
 }
 
-void Event::run_sequence()
+void _run_(Sequence * sequence)
 {
    std::list<Action *>::iterator cmd;
 
-   for (cmd = sequence.begin(); cmd != sequence.end(); cmd++)
+   cmd = sequence->sequ.begin();
+   while (!sequence->cancel && cmd != sequence->sequ.end())
    {
-      Log << "Executing " + (*cmd)->command_line();
+      Log << "[" + sequence->label + "] Executing " + (*cmd)->command_line();
       (*cmd)->execute();
+      //Log << "[" + sequence->label + "] Cancel state = " + String(sequence->cancel);
+      cmd++;
    }
+   //Log << "[" + sequence->label + "] Thread finished.";
+}
+
+void Sequence::run()
+{
+   cancel = false;
+
+   runner = std::thread(_run_, this);
+   runner.detach();
+   //Log << "[" + label + "] Thread started.";
+
+}
+
+void Sequence::stop(void)
+{
+   Log << "[" + label + "] Stopping sequence ";
+   cancel = true;
+}
+
+Sequence *Event::run_sequence()
+{
+   seq->run();
+   return seq;
 }
 
 UTC Event::next_occurance(UTC after, Location loc)
index 00ea1a1..37b8617 100644 (file)
@@ -1,12 +1,41 @@
 
 #include <list>
 #include <set>
+#include <thread>
+
 #include <xml.h>
 #include <date.h>
 
 #include "location.h"
 #include "action.h"
 
+class Sequence
+{
+   String              label;
+   std::list<Action *> sequ;
+
+   std::thread          runner;
+
+   bool                 cancel;
+
+public: 
+   Sequence (String lbl)
+   {
+      label = lbl;
+   }
+
+   void  add_action(String command);
+   String ToXML(void);
+   String id()
+   {
+      return label;
+   }
+
+   void run(void);
+   void stop(void);
+   friend void _run_(Sequence * sequence);
+};
+
 class Event
 {
    String              label;
@@ -17,6 +46,9 @@ class Event
    std::set<int>       weekdays;
 
    std::list<Action *> sequence;
+   Sequence            *seq;
+
+   //std::thread         running;
 
 public:
 
@@ -46,7 +78,7 @@ public:
    }
 
    void  add_action(String command);
-   void  run_sequence();
+   Sequence *run_sequence();
 
    UTC   next_occurance(UTC after, Location loc);
 };
index f5c0100..6cf1f2e 100644 (file)
@@ -10,6 +10,8 @@
 #include <stdio.h>
 #include <unistd.h>
 #include <getopt.h>
+#include <signal.h>
+
 #include <iostream>
 #include <fstream>
 #include <sstream>
@@ -216,12 +218,26 @@ std::ostringstream report_lights(std::vector<color_level> lights)
  *   Fade the lights from the start level to the end level in the specified fade time.
  */
 
-void lightfade(std::vector<color_level> start_lvl, std::vector<color_level> end_lvl, int fade)
+void lightfade(std::vector<color_level> start_lvl, std::vector<color_level> end_lvl, int fade, double acc)
 {
    int     maximum_difference;
    Tachyon timebase;
 
 
+   std::ifstream otherpidfile("lightcontrol.pid");
+   if (otherpidfile.good())
+   {
+      pid_t   otherpid;
+
+      otherpidfile >> otherpid;
+      //std::cerr << "Another lightcontrol is running, pid = " << otherpid << "\n";
+      kill(otherpid, SIGTERM);
+   }
+
+   std::ofstream pidfile("lightcontrol.pid");
+   pidfile << getpid() << "\n";
+   pidfile.close();
+
    std::ofstream runfile("lightcontrol.run");
    runfile << timebase.name() << "\n";
    runfile.close();
@@ -243,6 +259,8 @@ void lightfade(std::vector<color_level> start_lvl, std::vector<color_level> end_
       float   step_time = float(fade) / maximum_difference;
       float   time_counter = 0;
 
+      timebase.accellerate(acc);
+
       while (time_counter < fade)
       {
          std::vector<color_level> cur_lvl = start_lvl;
@@ -267,6 +285,7 @@ void lightfade(std::vector<color_level> start_lvl, std::vector<color_level> end_
    }
 
    light_to_pwm(end_lvl);
+   remove("lightcontrol.pid");
    remove("lightcontrol.run");
 }
 
@@ -305,6 +324,7 @@ int main(int argc, char *argv[])
    log << start_message + parent_command();
 
    int  fade_time = 0;
+   double accelleration = 1.0;
    bool change_lights = false;
 
    pwm  *signals;
@@ -345,7 +365,7 @@ int main(int argc, char *argv[])
    int     option;
 
 
-   while ((option = getopt(argc, argv, "r:g:b:w:f:lvV")) != -1)
+   while ((option = getopt(argc, argv, "r:g:b:w:f:a:lvV")) != -1)
    {
       lvl_ptr p;
 
@@ -376,6 +396,10 @@ int main(int argc, char *argv[])
          fade_time = atoi(optarg);
          break;
 
+      case 'a':
+         accelleration = strtod(optarg, NULL);
+         break;
+
       case 'l':
          p = find_level(lightlevels, RED);
         std::cout << p->level << " ";
@@ -411,7 +435,7 @@ int main(int argc, char *argv[])
          report << ", fading in " << fade_time << " seconds";
       }
       log << report.str().c_str();
-      lightfade(lightlevels, desired_levels, fade_time);
+      lightfade(lightlevels, desired_levels, fade_time, accelleration);
    }
 }
 
index d23997f..38796f9 100644 (file)
@@ -47,9 +47,16 @@ void setup_io();
 
 #define SWITCH_IN    2
 
+#define FIRMASK 0x03
+
+#define TEST_CYCLES  (60 * 5)  //  1 minute
+
+unsigned fir_record[TEST_CYCLES];
 
 int main(int argc, char *argv[])
 {
+   unsigned int fir;  // A simple FIR filter
+
    int    old_state, new_state;
    struct timespec interval;
 
@@ -62,14 +69,32 @@ int main(int argc, char *argv[])
    // Initialize the IO pins.
    INP_GPIO(SWITCH_IN);
 
-   old_state = GET_GPIO(SWITCH_IN);
+   //   Initialize to switched off state
+   fir = 0xffff;
+   old_state = 1;  // Off
 
-   while (1)
+   int cycle = 0;
+   //while (1)
+   while (cycle < TEST_CYCLES)
    {
-      new_state = GET_GPIO(SWITCH_IN);
+      unsigned input = GET_GPIO(SWITCH_IN) == 0 ? 0 : 1;
+      fir <<= 1;
+      fir |= input;
+
+      //fprintf(stderr, "FIR =  0x%x\r", fir);
+      if ( (fir & FIRMASK) == 0)
+      {
+         new_state = 0;   // On
+      }
+      if ( (fir & FIRMASK) == FIRMASK)
+      {
+         new_state = 1;   // Off
+      }
+
       if (new_state != old_state)
       {
-         //fprintf(stderr, "Changed state to %d\n", new_state);
+         //fprintf(stderr, "Changed state to %d\r", new_state);
          if (new_state == 0)
          {
             system("lightcontrol -r 100 -g 100 -b 100 -w 100");
@@ -81,9 +106,16 @@ int main(int argc, char *argv[])
 
          old_state = new_state;
       }
+      fir_record[cycle++] = fir;
+
       nanosleep(&interval, NULL);
    }
 
+   for (int i = 0; i < TEST_CYCLES; i++)
+   {
+      printf("FIR = 0x%08x\n", fir_record[i]);
+   }
+
    return 0;
 }
 
index e0ddd20..ad27e30 100644 (file)
@@ -1,3 +1,5 @@
+#include <thread>
+
 #include <date.h>
 
 #include "logging.h"
@@ -9,7 +11,8 @@ logstream & logstream::operator << (const char *msg)
 
    timestamp = Now();
 
-   destination << timestamp << ": " << msg << "\n";
+   //destination << timestamp << " [" << std::this_thread::get_id() << "]: " << msg << "\n";
+   destination << timestamp << " : " << msg << "\n";
    destination.flush();
 
    return *this;
@@ -21,7 +24,8 @@ logstream & logstream::operator << (const String &msg)
 
    timestamp = Now();
 
-   destination << timestamp << ": " << msg << "\n";
+   //destination << timestamp << " [" << std::this_thread::get_id() << "]: " << msg << "\n";
+   destination << timestamp << " : " << msg << "\n";
    destination.flush();
 
    return *this;
index 637d189..d5fbf0c 100644 (file)
@@ -2,6 +2,7 @@
 #include <sys/types.h>
 #include <unistd.h>
 
+#include <thread>
 
 #include <configuration.h>
 #include <Tachyon.h>
@@ -25,8 +26,6 @@ std::list<Event> calculate_occurances(std::list<Event> alarms, Location loc)
       UTC next_time;
 
       next_time = alarm->next_occurance(UTC(Timebase.time()), loc);
-      //DEBUG
-      std::cout << "Next alarm after will be " << next_time << ".\n";
       if ( next_time != UTC(date(0,0,0), hour(0)))
       {
          future_alarms.push_back(*alarm);
@@ -90,13 +89,12 @@ int main()
    double    longitude = Config.find_parameter("location", "longitude");
    Location  local(latitude, longitude);
 
+   Sequence *running = 0;
    while (true)
    {
       UTC this_moment = UTC(Timebase.time());
 
       pending_alarms =  calculate_occurances(set_alarms, local);
-      // DEBUG
-      //std::cout << alarms_to_XML(pending_alarms);
 
       //  Find the next alarm
 
@@ -116,12 +114,15 @@ int main()
       }
    
       UTC next_time   = next_alarm.next_occurance(this_moment, local);
-      // DEBUG
-      //std::cout << "Sleep from " << this_moment << " until " << next_time << " (" << next_time - this_moment << " seconds)\n";
+      //Log << "Next alarm " + next_alarm.id() + " will be at " + next_time.format();
       if (Timebase.nanosleep(next_time - this_moment) == 0)
       {
          Log << "Alarm " + next_alarm.id() + " triggered at " + next_time.format();
-         next_alarm.run_sequence();
+         if (running != 0)
+         {
+            running->stop();     //  TODO check for a cancel action
+         }
+         running = next_alarm.run_sequence();
       }
       else
       {
index 220c0d4..d99a522 100644 (file)
@@ -1,7 +1,8 @@
 TESTS = lightctrl lightctrl-oor lightctrl-fade \
         wakeup_load_events sunrise_test event_recurrance event_run_sequence \
-        wakeup_winter sunset_winter \
+        wakeup_winter sunset_winter wakeup_spring \ 
         check_output
+#        wakeup_summer 
 
 AM_CPPFLAGS = -I../src
 LDADD = -lTachyon -lACL
index 4ff475d..44e14b3 100644 (file)
@@ -15,7 +15,7 @@
        <pattern>days</pattern>
        <number>1</number>
     </recurrance>
-    <action>lightcontrol -b 50 -w 0 -f 9</action>
+    <action>lightcontrol -b 50 -w 0 -f 900 -a 1000</action>
   </event>
   <event id='lights_off'>
     <start>2020-04-02 22:30</start>
@@ -23,7 +23,7 @@
        <pattern>days</pattern>
        <number>1</number>
     </recurrance>
-    <action>lightcontrol -b 0 -f 18</action>
+    <action>lightcontrol -b 0 -f 1800 -a 1000</action>
   </event>
   <event id='end_test'>
     <start>2020-04-08 11:00</start>
index 8f0e32b..340add5 100755 (executable)
@@ -19,7 +19,7 @@ sleep 1
 read TACHYON_NAME <wakeup.run
 Time=`date --date '2020-12-17 15:00' +%s`
 tachyon -t $Time $TACHYON_NAME
-tachyon -a 100   $TACHYON_NAME
+tachyon -a 1000   $TACHYON_NAME
 
 ln -f -s sunset_alarms.xml wakeup_link.xml
 
index 67f6128..1d3b946 100644 (file)
@@ -1,48 +1,71 @@
-wakeup started
-Reading alarms from wakeup_link.xml
-SIGHUP received.
-Reading alarms from wakeup_link.xml
-Alarm sunset triggered at 2020-12-17 16:27:00
-Executing curtain -c 1 -t
-Executing lightcontrol -b 99 -w 50
-Alarm evening_dim triggered at 2020-12-17 22:00:00
-Executing lightcontrol -b 50 -w 0 -f 9
-Alarm lights_off triggered at 2020-12-17 22:30:00
-Executing lightcontrol -b 0 -f 18
-Alarm sunset triggered at 2020-12-18 16:27:00
-Executing curtain -c 1 -t
-Executing lightcontrol -b 99 -w 50
-Alarm evening_dim triggered at 2020-12-18 22:00:00
-Executing lightcontrol -b 50 -w 0 -f 9
-Alarm lights_off triggered at 2020-12-18 22:30:00
-Executing lightcontrol -b 0 -f 18
-Alarm sunset triggered at 2020-12-19 16:26:53
-Executing curtain -c 1 -t
-Executing lightcontrol -b 99 -w 50
-Alarm evening_dim triggered at 2020-12-19 22:00:00
-Executing lightcontrol -b 50 -w 0 -f 9
-Alarm lights_off triggered at 2020-12-19 22:30:00
-Executing lightcontrol -b 0 -f 18
-Alarm sunset triggered at 2020-12-20 16:26:48
-Executing curtain -c 1 -t
-Executing lightcontrol -b 99 -w 50
-Alarm evening_dim triggered at 2020-12-20 22:00:00
-Executing lightcontrol -b 50 -w 0 -f 9
-Alarm lights_off triggered at 2020-12-20 22:30:00
-Executing lightcontrol -b 0 -f 18
-Alarm sunset triggered at 2020-12-21 16:26:47
-Executing curtain -c 1 -t
-Executing lightcontrol -b 99 -w 50
-Alarm evening_dim triggered at 2020-12-21 22:00:00
-Executing lightcontrol -b 50 -w 0 -f 9
-Alarm lights_off triggered at 2020-12-21 22:30:00
-Executing lightcontrol -b 0 -f 18
-Alarm sunset triggered at 2020-12-22 16:26:48
-Executing curtain -c 1 -t
-Executing lightcontrol -b 99 -w 50
-Alarm evening_dim triggered at 2020-12-22 22:00:00
-Executing lightcontrol -b 50 -w 0 -f 9
-Alarm lights_off triggered at 2020-12-22 22:30:00
-Executing lightcontrol -b 0 -f 18
-Alarm end_test triggered at 2020-12-23 11:00:00
-Executing exit
+ wakeup started
+ Reading alarms from wakeup_link.xml
+ SIGHUP received.
+ Reading alarms from wakeup_link.xml
+ Alarm sunset triggered at 2020-12-17 16:27:00
+ [sunset] Executing curtain -c 1 -t
+ [sunset] Executing lightcontrol -b 99 -w 50
+ Alarm evening_dim triggered at 2020-12-17 22:00:00
+ [sunset] Stopping sequence 
+ [evening_dim] Executing lightcontrol -b 50 -w 0 -f 900 -a 1000
+ Alarm lights_off triggered at 2020-12-17 22:30:00
+ [evening_dim] Stopping sequence 
+ [lights_off] Executing lightcontrol -b 0 -f 1800 -a 1000
+ Alarm sunset triggered at 2020-12-18 16:27:00
+ [lights_off] Stopping sequence 
+ [sunset] Executing curtain -c 1 -t
+ [sunset] Executing lightcontrol -b 99 -w 50
+ Alarm evening_dim triggered at 2020-12-18 22:00:00
+ [sunset] Stopping sequence 
+ [evening_dim] Executing lightcontrol -b 50 -w 0 -f 900 -a 1000
+ Alarm lights_off triggered at 2020-12-18 22:30:00
+ [evening_dim] Stopping sequence 
+ [lights_off] Executing lightcontrol -b 0 -f 1800 -a 1000
+ Alarm sunset triggered at 2020-12-19 16:26:53
+ [lights_off] Stopping sequence 
+ [sunset] Executing curtain -c 1 -t
+ [sunset] Executing lightcontrol -b 99 -w 50
+ Alarm evening_dim triggered at 2020-12-19 22:00:00
+ [sunset] Stopping sequence 
+ [evening_dim] Executing lightcontrol -b 50 -w 0 -f 900 -a 1000
+ Alarm lights_off triggered at 2020-12-19 22:30:00
+ [evening_dim] Stopping sequence 
+ [lights_off] Executing lightcontrol -b 0 -f 1800 -a 1000
+ Alarm sunset triggered at 2020-12-20 16:26:48
+ [lights_off] Stopping sequence 
+ [sunset] Executing curtain -c 1 -t
+ [sunset] Executing lightcontrol -b 99 -w 50
+ Alarm evening_dim triggered at 2020-12-20 22:00:00
+ [sunset] Stopping sequence 
+ [evening_dim] Executing lightcontrol -b 50 -w 0 -f 900 -a 1000
+ Alarm lights_off triggered at 2020-12-20 22:30:00
+ [evening_dim] Stopping sequence 
+ [lights_off] Executing lightcontrol -b 0 -f 1800 -a 1000
+ Alarm sunset triggered at 2020-12-21 16:26:47
+ [lights_off] Stopping sequence 
+ [sunset] Executing curtain -c 1 -t
+ [sunset] Executing lightcontrol -b 99 -w 50
+ Alarm evening_dim triggered at 2020-12-21 22:00:00
+ [sunset] Stopping sequence 
+ [evening_dim] Executing lightcontrol -b 50 -w 0 -f 900 -a 1000
+ Alarm lights_off triggered at 2020-12-21 22:30:00
+ [evening_dim] Stopping sequence 
+ [lights_off] Executing lightcontrol -b 0 -f 1800 -a 1000
+ Alarm sunset triggered at 2020-12-22 16:26:48
+ [lights_off] Stopping sequence 
+ [sunset] Executing curtain -c 1 -t
+ Alarm sunset triggered at 2020-12-22 16:26:53
+ [sunset] Stopping sequence 
+ [sunset] Executing curtain -c 1 -t
+ [sunset] Executing lightcontrol -b 99 -w 50
+ [sunset] Executing lightcontrol -b 99 -w 50
+ [sunset] Executing lightcontrol -b 99 -w 50
+ Alarm evening_dim triggered at 2020-12-22 22:00:00
+ [sunset] Stopping sequence 
+ [evening_dim] Executing lightcontrol -b 50 -w 0 -f 900 -a 1000
+ Alarm lights_off triggered at 2020-12-22 22:30:00
+ [evening_dim] Stopping sequence 
+ [lights_off] Executing lightcontrol -b 0 -f 1800 -a 1000
+ Alarm end_test triggered at 2020-12-23 11:00:00
+ [lights_off] Stopping sequence 
+ [end_test] Executing exit
index 48cc16a..87b2f77 100644 (file)
@@ -6,14 +6,15 @@
        <pattern>weekdays</pattern>
        <number>1,2,3,4,5</number>
     </recurrance>
-    <action>lightcontrol -r 10 -f 2</action>
-    <action>lightcontrol -g 10 -f 2</action>
-    <action>lightcontrol -w 10 -f 2</action>
+    <action>lightcontrol -r 10 -f 300 -a 1000</action>
+    <action>lightcontrol -g 10 -f 300 -a 1000</action>
+    <action>lightcontrol -w 10 -f 300 -a 1000</action>
   </event>
   <event id='sunrise'>
     <start>sunrise</start>
+    <action>cancel lightson_workdays</action>
     <action>curtain -o 2 -t</action>
-    <action>lightcontrol -r 0 -g 0 -w 0-f 2</action>
+    <action>lightcontrol -r 0 -g 0 -w 0 -f 100 -a 1000</action>
     <recurrance>
        <pattern>weekdays</pattern>
        <number>1,2,3,4,5</number>
diff --git a/test/wakeup_spring b/test/wakeup_spring
new file mode 100755 (executable)
index 0000000..fe0ccaf
--- /dev/null
@@ -0,0 +1,37 @@
+#!/bin/bash
+#
+#  Test the wakeup sequence in spring.
+#  Sunrise happens a few minutes after wakeup time
+#
+set -m
+PATH=../src:$PATH
+
+# Reset the lights and clear the log files
+
+lightcontrol -r 0 -g 0 -b 0 -w 0
+> lightcontrol.log
+> wakeup.log
+
+ln -f -s wakeup_empty.xml wakeup_link.xml
+
+wakeup &
+sleep 1
+
+read TACHYON_NAME <wakeup.run
+Time=`date --date '2020-05-07 05:00' +%s`
+tachyon -t $Time $TACHYON_NAME
+tachyon -a 1000   $TACHYON_NAME
+
+ln -f -s wakeup_alarms.xml wakeup_link.xml
+
+kill -HUP `cat wakeup.pid`
+
+fg %1
+#kill  `cat wakeup.pid`
+
+# Remove timestamps from the log.
+cut -c 22- wakeup.log >wakeup_spring.log.test
+
+diff wakeup_spring.log.test wakeup_spring.log.expect
+
+exit $?
diff --git a/test/wakeup_spring.log.expect b/test/wakeup_spring.log.expect
new file mode 100644 (file)
index 0000000..e7157fa
--- /dev/null
@@ -0,0 +1,69 @@
+ wakeup started
+ Reading alarms from wakeup_link.xml
+ SIGHUP received.
+ Reading alarms from wakeup_link.xml
+ Alarm lightson_workdays triggered at 2020-05-07 06:00:00
+ [lightson_workdays] Executing lightcontrol -r 10 -f 300 -a 1000
+ [lightson_workdays] Executing lightcontrol -g 10 -f 300 -a 1000
+ Alarm sunrise triggered at 2020-05-07 06:09:46
+ [lightson_workdays] Stopping sequence 
+ [sunrise] Executing cancel lightson_workdays
+ [sunrise] Executing curtain -o 2 -t
+ [sunrise] Executing lightcontrol -r 0 -g 0 -w 0 -f 100 -a 1000
+ Alarm open_curtains triggered at 2020-05-07 09:00:00
+ [sunrise] Stopping sequence 
+ [open_curtains] Executing curtain -o 1 -t
+ Alarm lightson_workdays triggered at 2020-05-08 06:00:00
+ [open_curtains] Stopping sequence 
+ [lightson_workdays] Executing lightcontrol -r 10 -f 300 -a 1000
+ [lightson_workdays] Executing lightcontrol -g 10 -f 300 -a 1000
+ Alarm sunrise triggered at 2020-05-08 06:08:06
+ [lightson_workdays] Stopping sequence 
+ [sunrise] Executing cancel lightson_workdays
+ [sunrise] Executing curtain -o 2 -t
+ [sunrise] Executing lightcontrol -r 0 -g 0 -w 0 -f 100 -a 1000
+ Alarm open_curtains triggered at 2020-05-08 09:00:00
+ [sunrise] Stopping sequence 
+ [open_curtains] Executing curtain -o 1 -t
+ Alarm open_curtains triggered at 2020-05-09 09:00:00
+ [open_curtains] Stopping sequence 
+ [open_curtains] Executing curtain -o 1 -t
+ Alarm open_curtains triggered at 2020-05-10 09:00:00
+ [open_curtains] Stopping sequence 
+ [open_curtains] Executing curtain -o 1 -t
+ Alarm lightson_workdays triggered at 2020-05-11 06:00:00
+ [open_curtains] Stopping sequence 
+ [lightson_workdays] Executing lightcontrol -r 10 -f 300 -a 1000
+ Alarm sunrise triggered at 2020-05-11 06:03:12
+ [lightson_workdays] Stopping sequence 
+ [sunrise] Executing cancel lightson_workdays
+ [sunrise] Executing curtain -o 2 -t
+ [sunrise] Executing lightcontrol -r 0 -g 0 -w 0 -f 100 -a 1000
+ Alarm open_curtains triggered at 2020-05-11 09:00:00
+ [sunrise] Stopping sequence 
+ [open_curtains] Executing curtain -o 1 -t
+ Alarm lightson_workdays triggered at 2020-05-12 06:00:00
+ [open_curtains] Stopping sequence 
+ [lightson_workdays] Executing lightcontrol -r 10 -f 300 -a 1000
+ Alarm sunrise triggered at 2020-05-12 06:01:37
+ [lightson_workdays] Stopping sequence 
+ [sunrise] Executing cancel lightson_workdays
+ [sunrise] Executing curtain -o 2 -t
+ [sunrise] Executing lightcontrol -r 0 -g 0 -w 0 -f 100 -a 1000
+ Alarm open_curtains triggered at 2020-05-12 09:00:00
+ [sunrise] Stopping sequence 
+ [open_curtains] Executing curtain -o 1 -t
+ Alarm lightson_workdays triggered at 2020-05-13 06:00:00
+ [open_curtains] Stopping sequence 
+ [lightson_workdays] Executing lightcontrol -r 10 -f 300 -a 1000
+ Alarm sunrise triggered at 2020-05-13 06:00:03
+ [lightson_workdays] Stopping sequence 
+ [sunrise] Executing cancel lightson_workdays
+ [sunrise] Executing curtain -o 2 -t
+ [sunrise] Executing lightcontrol -r 0 -g 0 -w 0 -f 100 -a 1000
+ Alarm open_curtains triggered at 2020-05-13 09:00:00
+ [sunrise] Stopping sequence 
+ [open_curtains] Executing curtain -o 1 -t
+ Alarm end_test triggered at 2020-05-13 11:00:00
+ [open_curtains] Stopping sequence 
+ [end_test] Executing exit
diff --git a/test/wakeup_summer b/test/wakeup_summer
new file mode 100755 (executable)
index 0000000..442d775
--- /dev/null
@@ -0,0 +1,37 @@
+#!/bin/bash
+#
+#  Test the wakeup sequence in summer.
+#  Sunrise happens before the wakeup time.
+#
+set -m
+PATH=../src:$PATH
+
+# Reset the lights and clear the log files
+
+lightcontrol -r 0 -g 0 -b 0 -w 0
+> lightcontrol.log
+> wakeup.log
+
+ln -f -s wakeup_empty.xml wakeup_link.xml
+
+wakeup &
+sleep 1
+
+read TACHYON_NAME <wakeup.run
+Time=`date --date '2020-06-17 05:00' +%s`
+tachyon -t $Time $TACHYON_NAME
+tachyon -a 100   $TACHYON_NAME
+
+ln -f -s wakeup_alarms.xml wakeup_link.xml
+
+kill -HUP `cat wakeup.pid`
+
+fg %1
+#kill  `cat wakeup.pid`
+
+# Remove timestamps from the log.
+cut -c 22- wakeup.log >wakeup_summer.log.test
+
+diff wakeup_summer.log.test wakeup_summer.log.expect
+
+exit $?
diff --git a/test/wakeup_summer.log.expect b/test/wakeup_summer.log.expect
new file mode 100644 (file)
index 0000000..ff80e7f
--- /dev/null
@@ -0,0 +1,11 @@
+wakeup started
+Reading alarms from wakeup_link.xml
+SIGHUP received.
+Reading alarms from wakeup_link.xml
+Alarm sunrise triggered at 2020-06-17 05:27:06
+Executing curtain -o 2 -t
+Executing lightcontrol -r 0 -g 0 -w 0 -f 2
+Alarm open_curtains triggered at 2020-06-17 09:00:00
+Executing curtain -o 1 -t
+Alarm end_test triggered at 2020-06-17 11:00:00
+Executing exit
index 4970c7c..028601a 100755 (executable)
@@ -19,7 +19,7 @@ sleep 1
 read TACHYON_NAME <wakeup.run
 Time=`date --date '2020-12-17 05:00' +%s`
 tachyon -t $Time $TACHYON_NAME
-tachyon -a 100   $TACHYON_NAME
+tachyon -a 1000   $TACHYON_NAME
 
 ln -f -s wakeup_alarms.xml wakeup_link.xml
 
index 0c15a91..08cfa98 100644 (file)
@@ -1,55 +1,77 @@
-wakeup started
-Reading alarms from wakeup_link.xml
-SIGHUP received.
-Reading alarms from wakeup_link.xml
-Alarm lightson_workdays triggered at 2020-12-17 06:00:00
-Executing lightcontrol -r 10 -f 2
-Executing lightcontrol -g 10 -f 2
-Executing lightcontrol -w 10 -f 2
-Alarm sunrise triggered at 2020-12-17 08:54:16
-Executing curtain -o 2 -t
-Executing lightcontrol -r 0 -g 0 -w 0-f 2
-Alarm open_curtains triggered at 2020-12-17 09:00:00
-Executing curtain -o 1 -t
-Alarm lightson_workdays triggered at 2020-12-18 06:00:00
-Executing lightcontrol -r 10 -f 2
-Executing lightcontrol -g 10 -f 2
-Executing lightcontrol -w 10 -f 2
-Alarm sunrise triggered at 2020-12-18 08:54:23
-Executing curtain -o 2 -t
-Executing lightcontrol -r 0 -g 0 -w 0-f 2
-Alarm open_curtains triggered at 2020-12-18 09:00:00
-Executing curtain -o 1 -t
-Alarm open_curtains triggered at 2020-12-19 09:00:00
-Executing curtain -o 1 -t
-Alarm open_curtains triggered at 2020-12-20 09:00:00
-Executing curtain -o 1 -t
-Alarm lightson_workdays triggered at 2020-12-21 06:00:00
-Executing lightcontrol -r 10 -f 2
-Executing lightcontrol -g 10 -f 2
-Executing lightcontrol -w 10 -f 2
-Alarm sunrise triggered at 2020-12-21 08:54:28
-Executing curtain -o 2 -t
-Executing lightcontrol -r 0 -g 0 -w 0-f 2
-Alarm open_curtains triggered at 2020-12-21 09:00:00
-Executing curtain -o 1 -t
-Alarm lightson_workdays triggered at 2020-12-22 06:00:00
-Executing lightcontrol -r 10 -f 2
-Executing lightcontrol -g 10 -f 2
-Executing lightcontrol -w 10 -f 2
-Alarm sunrise triggered at 2020-12-22 08:54:23
-Executing curtain -o 2 -t
-Executing lightcontrol -r 0 -g 0 -w 0-f 2
-Alarm open_curtains triggered at 2020-12-22 09:00:00
-Executing curtain -o 1 -t
-Alarm lightson_workdays triggered at 2020-12-23 06:00:00
-Executing lightcontrol -r 10 -f 2
-Executing lightcontrol -g 10 -f 2
-Executing lightcontrol -w 10 -f 2
-Alarm sunrise triggered at 2020-12-23 08:54:16
-Executing curtain -o 2 -t
-Executing lightcontrol -r 0 -g 0 -w 0-f 2
-Alarm open_curtains triggered at 2020-12-23 09:00:00
-Executing curtain -o 1 -t
-Alarm end_test triggered at 2020-12-23 11:00:00
-Executing exit
+ wakeup started
+ Reading alarms from wakeup_link.xml
+ SIGHUP received.
+ Reading alarms from wakeup_link.xml
+ Alarm lightson_workdays triggered at 2020-12-17 06:00:00
+ [lightson_workdays] Executing lightcontrol -r 10 -f 300 -a 1000
+ [lightson_workdays] Executing lightcontrol -g 10 -f 300 -a 1000
+ [lightson_workdays] Executing lightcontrol -w 10 -f 300 -a 1000
+ Alarm sunrise triggered at 2020-12-17 08:54:16
+ [lightson_workdays] Stopping sequence 
+ [sunrise] Executing cancel lightson_workdays
+ [sunrise] Executing curtain -o 2 -t
+ [sunrise] Executing lightcontrol -r 0 -g 0 -w 0 -f 100 -a 1000
+ Alarm open_curtains triggered at 2020-12-17 09:00:00
+ [sunrise] Stopping sequence 
+ [open_curtains] Executing curtain -o 1 -t
+ Alarm lightson_workdays triggered at 2020-12-18 06:00:00
+ [open_curtains] Stopping sequence 
+ [lightson_workdays] Executing lightcontrol -r 10 -f 300 -a 1000
+ [lightson_workdays] Executing lightcontrol -g 10 -f 300 -a 1000
+ [lightson_workdays] Executing lightcontrol -w 10 -f 300 -a 1000
+ Alarm sunrise triggered at 2020-12-18 08:54:23
+ [lightson_workdays] Stopping sequence 
+ [sunrise] Executing cancel lightson_workdays
+ [sunrise] Executing curtain -o 2 -t
+ [sunrise] Executing lightcontrol -r 0 -g 0 -w 0 -f 100 -a 1000
+ Alarm open_curtains triggered at 2020-12-18 09:00:00
+ [sunrise] Stopping sequence 
+ [open_curtains] Executing curtain -o 1 -t
+ Alarm open_curtains triggered at 2020-12-19 09:00:00
+ [open_curtains] Stopping sequence 
+ [open_curtains] Executing curtain -o 1 -t
+ Alarm open_curtains triggered at 2020-12-20 09:00:00
+ [open_curtains] Stopping sequence 
+ [open_curtains] Executing curtain -o 1 -t
+ Alarm lightson_workdays triggered at 2020-12-21 06:00:00
+ [open_curtains] Stopping sequence 
+ [lightson_workdays] Executing lightcontrol -r 10 -f 300 -a 1000
+ [lightson_workdays] Executing lightcontrol -g 10 -f 300 -a 1000
+ [lightson_workdays] Executing lightcontrol -w 10 -f 300 -a 1000
+ Alarm sunrise triggered at 2020-12-21 08:54:28
+ [lightson_workdays] Stopping sequence 
+ [sunrise] Executing cancel lightson_workdays
+ [sunrise] Executing curtain -o 2 -t
+ [sunrise] Executing lightcontrol -r 0 -g 0 -w 0 -f 100 -a 1000
+ Alarm open_curtains triggered at 2020-12-21 09:00:00
+ [sunrise] Stopping sequence 
+ [open_curtains] Executing curtain -o 1 -t
+ Alarm lightson_workdays triggered at 2020-12-22 06:00:00
+ [open_curtains] Stopping sequence 
+ [lightson_workdays] Executing lightcontrol -r 10 -f 300 -a 1000
+ [lightson_workdays] Executing lightcontrol -g 10 -f 300 -a 1000
+ [lightson_workdays] Executing lightcontrol -w 10 -f 300 -a 1000
+ Alarm sunrise triggered at 2020-12-22 08:54:23
+ [lightson_workdays] Stopping sequence 
+ [sunrise] Executing cancel lightson_workdays
+ [sunrise] Executing curtain -o 2 -t
+ [sunrise] Executing lightcontrol -r 0 -g 0 -w 0 -f 100 -a 1000
+ Alarm open_curtains triggered at 2020-12-22 09:00:00
+ [sunrise] Stopping sequence 
+ [open_curtains] Executing curtain -o 1 -t
+ Alarm lightson_workdays triggered at 2020-12-23 06:00:00
+ [open_curtains] Stopping sequence 
+ [lightson_workdays] Executing lightcontrol -r 10 -f 300 -a 1000
+ [lightson_workdays] Executing lightcontrol -g 10 -f 300 -a 1000
+ [lightson_workdays] Executing lightcontrol -w 10 -f 300 -a 1000
+ Alarm sunrise triggered at 2020-12-23 08:54:16
+ [lightson_workdays] Stopping sequence 
+ [sunrise] Executing cancel lightson_workdays
+ [sunrise] Executing curtain -o 2 -t
+ [sunrise] Executing lightcontrol -r 0 -g 0 -w 0 -f 100 -a 1000
+ Alarm open_curtains triggered at 2020-12-23 09:00:00
+ [sunrise] Stopping sequence 
+ [open_curtains] Executing curtain -o 1 -t
+ Alarm end_test triggered at 2020-12-23 11:00:00
+ [open_curtains] Stopping sequence 
+ [end_test] Executing exit