Skip to content

String record handling data truncation #46

@AlexanderWells-diamond

Description

@AlexanderWells-diamond

When creating a string record, if you set an initial_value that is longer than 39 characters the data is silently truncated. It would be useful if there was at least a warning/error of some kind emitted when this occurs.

In this example note that the trailing "!" of the string is missing:

# Import the basic framework components.
from softioc import softioc, builder, asyncio_dispatcher

# Create an asyncio dispatcher, the event loop is now running
dispatcher = asyncio_dispatcher.AsyncioDispatcher()

# Set the record prefix
builder.SetDeviceName("PREFIX")

# Create some records
bo1 = builder.stringOut('SO', initial_value="hello this is long sentence of 39 chars!")

# Boilerplate get the IOC started
builder.LoadDatabase()
softioc.iocInit(dispatcher)

# Finally leave the IOC running with an interactive shell.
softioc.interactive_ioc(globals())

Getting the value:

[...]$ caget PREFIX:SO
PREFIX:SO                      hello this is long sentence of 39 chars

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions