caproto.ChannelString

Inheritance diagram of ChannelString
class caproto.ChannelString(*, alarm=None, value=None, timestamp=None, max_length=None, string_encoding='latin-1', reported_record_type='caproto', long_string_max_length=81)[source]

8-bit encoded string data plus metadata which can be sent over a channel.

Allows for simple access over CA to the first 40 characters as a DBR_STRING when report_as_string is set.

Parameters
valuestr

Initial starting data.

string_encodingstr, optional

The string encoding to use, defaults to ‘latin-1’.

long_string_max_lengthstr, optional

When requested as a long string (DBR_CHAR over Channel Access), this is the reported maximum length.

timestampfloat, optional

Posix timestamp associated with the value. Defaults to time.time().

max_lengthint, optional

Maximum array length of the data.

string_encodingstr, optional

Encoding to use for strings, used when serializing and deserializing data.

reported_record_typestr, optional

Though this is not a record, the channel access protocol supports querying the record type. This can be set to mimic an actual record or be set to something arbitrary. Defaults to ‘caproto’.

Methods

auth_read(hostname, username, data_type, *)

Get DBR data and native data, converted to a specific type

auth_write(hostname, username, data, …[, …])

Data write hook for clients.

calculate_length(value)

Calculate the number of elements given a value

check_access(hostname, username)

This always returns AccessRights.READ|AccessRights.WRITE.

is_compatible_array(value)

Check if the provided value is a compatible array.

post_state_change(state, new_value)

This is called by the server when it exits its StateUpdateContext.

pre_state_change(state, new_value)

This is called by the server when it enters its StateUpdateContext.

preprocess_value(value)

Pre-process values destined for verify_value and write

publish(flags)

Publish data to appropriate queues matching the SubscriptionSpec.

read(data_type)

Read out the ChannelData as data_type.

subscribe(queue, sub_spec, sub)

Subscribe a queue for the given subscription specification.

unsubscribe(queue, sub_spec)

Unsubscribe a queue for the given subscription specification.

update_fields(value)

This is a hook for subclasses to update field instance data.

verify_value(data)

Verify a value prior to it being written by CA or Python

write(value, *[, flags])

Write data from native Python types.

write_from_dbr(*args[, flags])

Write data from a provided DBR data type.

write_metadata([publish, units, precision, …])

Write metadata, optionally publishing information to clients.

Attributes

alarm

The ChannelAlarm associated with this data

data_type

epics_timestamp

EPICS timestamp as (seconds, nanoseconds) since EPICS epoch

length

The number of elements (length) of the current value

long_string_max_length

The maximum number of elements (length) of the current value

max_length

The maximum number of elements (length) this channel can hold

severity

Alarm severity

status

Alarm status

timestamp

Read-only access to timestamp data

value

Read-only access to value data