epics-ca-client

Write EPICS Channel Access client programs for PV reads, writes, and monitors.

1|1|Updated Apr 14, 2026
One-click install
npx skills add https://github.com/BCDA-APS/opencode-skills --skill epics-ca-client
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: epics-ca-client
Source: https://github.com/BCDA-APS/opencode-skills/tree/main/epics-ca-client
Command: npx skills add https://github.com/BCDA-APS/opencode-skills --skill epics-ca-client

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you write reliable EPICS Channel Access (CA) client programs that can connect to PVs, read and write values, and receive monitor updates with correct callback and error handling.

Core Features & Use Cases

  • Connection + channel management: Create channels with or without connection callbacks, query channel state, and handle connect/disconnect transitions safely.
  • Synchronous and asynchronous I/O: Perform ca_get/ca_array_get and ca_put/ca_array_put, including completion callbacks for async operations.
  • Subscriptions (monitors): Create event-driven monitors using ca_create_subscription with appropriate DBE event masks for value/alarm/property changes.
  • DBR type correctness & safety: Use the right DBR codes/structures (value-only, status, time, graphic, control) and follow the rule that data is only valid after ca_pend_io() completes.
  • Production-grade pitfalls: Apply best practices for CA context lifecycle, buffered I/O flushing, and robust error/exception handling.

Quick Start

Ask the AI to generate a C example that connects to a given PV, performs a synchronous DBR_DOUBLE read safely using ca_pend_io(), then installs a subscription that prints new values on change.

Frequently Asked Questions about epics-ca-client

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write an EPICS Channel Access client in C to monitor Process Variables?

To write an EPICS Channel Access client in C, you create a CA context, establish channel connections, and use ca_create_subscription with appropriate DBE event masks to monitor Process Variables and trigger callbacks on value, alarm, or property changes.

What's the best way to handle ca_get and ca_put callbacks in EPICS C programming?

Handling ca_get and ca_put callbacks in EPICS C programming requires using ca_array_get and ca_array_array_put with completion callbacks, then flushing the buffer with ca_flush_io and processing events via ca_pend_event or ca_pend_io to ensure data validity.

Why is my EPICS CA client reading invalid data before ca_pend_io completes?

EPICS CA client data is only valid after ca_pend_io completes because the Channel Access protocol buffers I/O operations; reading DBR structures before pending I/O finishes returns uninitialized or stale values, violating core CA data validity rules.

When do I need specific DBR types for EPICS Channel Access monitoring?

You need specific DBR types for EPICS Channel Access monitoring when applications require value-only data, status, time stamps, graphic limits, or control properties; selecting the correct DBR code ensures the subscription callback receives the proper structure.

Can I use EPICS Channel Access for synchronous and asynchronous PV workflows in C?

Yes, EPICS Channel Access supports both synchronous PV workflows using blocking ca_get and ca_put operations with ca_pend_io, and asynchronous workflows using completion callbacks and event-driven subscriptions with ca_pend_event in C client programs.

How to manage CA context lifecycle and connection handling in an EPICS C client?

Managing CA context lifecycle in an EPICS C client involves creating the context, safely handling channel connect and disconnect transitions with connection callbacks, querying channel state, and properly destroying the context to avoid resource leaks.