forked from daneos/lutango
41 lines
1.1 KiB
Lua
41 lines
1.1 KiB
Lua
-------------------------------------------------------------------------------
|
|
--
|
|
-- luTango - Lua binding for Tango
|
|
--
|
|
-- Copyright (C) 2023 Grzegorz Kowalski
|
|
-- See LICENSE for legal information
|
|
--
|
|
-- file: invalid_actions.lua
|
|
--
|
|
-- Test script attempting to perform various invalid actions
|
|
--
|
|
-------------------------------------------------------------------------------
|
|
|
|
local lut = require "lutango"
|
|
lut.log:set_log_level(lut.log.level.TRACE)
|
|
|
|
print("Attempting to access non-existent device")
|
|
local invalid = lut.DeviceProxy("non/existent/device")
|
|
|
|
local dp = lut.DeviceProxy(arg[1] or "sys/tg_test/1")
|
|
|
|
print("Attempting to write core function")
|
|
dp.get_attribute_list = 120
|
|
|
|
print("Attempting to write device command")
|
|
dp.SwitchStates = 0
|
|
|
|
print("Attempting to write read-only attribute")
|
|
dp.short_scalar_ro = 100
|
|
|
|
print("Attempting to access non-existent attribute")
|
|
local invalid2 = lut.AttributeProxy("sys/tg_test/1/nonexistent")
|
|
|
|
print("Attempting to write read-only attribute via AttributeProxy")
|
|
local attr_name = "sys/tg_test/1/short_scalar_ro"
|
|
if arg[1] and arg[2] then
|
|
attr_name = arg[1].."/"..arg[2]
|
|
end
|
|
local ap = lut.AttributeProxy(attr_name)
|
|
ap(100)
|