Skip to content

Creation of cl_gcalcli and sm_cl_gcalcli_test_1#701

Merged
brettpac merged 5 commits intojazzyfrom
brettpac_branch
Dec 31, 2025
Merged

Creation of cl_gcalcli and sm_cl_gcalcli_test_1#701
brettpac merged 5 commits intojazzyfrom
brettpac_branch

Conversation

@brettpac
Copy link
Collaborator

Addition of SMACC2 Google Calendar client library

Addition of new cl_gcalcli client library for Google Calendar integration via the gcalcli CLI tool. Enables SMACC2 state machines to react to calendar events with configurable pattern matching and timing.

Architecture

ClGcalcli (Orchestrator)
├── CpGcalcliConnection - Connection health monitoring, heartbeat
├── CpCalendarPoller - Agenda polling + TSV parsing
└── CpCalendarEventListener - Pattern matching + event dispatch

Components

  • CpGcalcliConnection: Monitors gcalcli connectivity via periodic
    heartbeat (gcalcli list). Tracks consecutive failures and emits
    connection events after 3 failures.

  • CpCalendarPoller: Polls calendar agenda at configurable intervals,
    parses gcalcli TSV output into CalendarEvent structs. Maintains
    thread-safe cached event list.

  • CpCalendarEventListener: Matches events against watch patterns
    (regex or substring). Triggers events based on start/end times
    with configurable minutes_before offset.

Client Behaviors

  • CbEventDetect: Async behavior that waits for matching event's
    start time to arrive. Supports regex patterns and early trigger.
  • CbStatus: Sync behavior to query connection state and events.
  • CbWaitConnection: Async behavior with timeout for initial connect.
  • CbMonitorConnection: Continuous connection health monitoring.
  • CbQuickAdd: Async behavior to add events via gcalcli quick.
  • CbRefreshAgenda: Sync behavior to force immediate agenda refresh.

Events

Connection events:

  • EvConnectionLost<TSource, TOrthogonal>
  • EvConnectionRestored<TSource, TOrthogonal>
  • EvAuthenticationRequired<TSource, TOrthogonal>

Calendar events:

  • EvCalendarEventDetected<TSource, TOrthogonal>
  • EvCalendarEventStarted<TSource, TOrthogonal>
  • EvCalendarEventEnded<TSource, TOrthogonal>
  • EvAgendaUpdated<TSource, TOrthogonal>

Configuration

  • gcalcli_path: Path to gcalcli executable (default: "gcalcli")
  • calendars: List of calendars to monitor (empty = all)
  • poll_interval: Agenda polling frequency (default: 30s)
  • heartbeat_interval: Connection check frequency (default: 60s)
  • agenda_days: Days ahead to fetch (default: 7)

Test State Machine (sm_cl_gcalcli_test_1)

Added reference state machine demonstrating all behaviors:

  • StInit → StWaitConnection → StTestEventDetect → StTestQuickAdd
    → StTestRefresh → StDone

States test:

  • CbWaitConnection with 30s timeout
  • CbEventDetect for "TestEvent" pattern (5 min early trigger)
  • CbMonitorConnection for connection health
  • CbQuickAdd to create test events
  • CbRefreshAgenda to force agenda update

Files Added

cl_gcalcli package (27 files):

  • include/cl_gcalcli/*.hpp (types, events, client)
  • include/cl_gcalcli/components/*.hpp (3 components)
  • include/cl_gcalcli/client_behaviors/*.hpp (6 behaviors)
  • src/cl_gcalcli/**/*.cpp (implementations)
  • CMakeLists.txt, package.xml, README.md

sm_cl_gcalcli_test_1 package (17 files):

  • include/sm_cl_gcalcli_test_1/*.hpp (state machine, orthogonals)
  • include/sm_cl_gcalcli_test_1/states/*.hpp (6 states)
  • src/, launch/, docs/
  • CMakeLists.txt, package.xml, README.md

@brettpac brettpac merged commit 28a5f24 into jazzy Dec 31, 2025
5 checks passed
@brettpac brettpac deleted the brettpac_branch branch December 31, 2025 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant