From OpenSCADAWiki
Jump to: navigation, search

Enter a message name below to show all available translations.

Message

Found 3 translations.

NameCurrent message text
 h English (en)Functions of the output transport object (SYS.Transport["Modul"]["out_Transp"]):
<ul>
<li>''bool isNetwork( )'' — the sign — "The transport is network one", what is specified by the timeouts in seconds.</li>
<li>''ElTp cfg( string nm )'' — gets the value of the configuration field ''nm'' of the object.</li>
<li>''bool cfgSet( string nm, ElTp val )'' [<span style='color:red'>access to the appropriate subsystem</span>] — sets the configuration field ''nm'' of the object to the value ''val''.</li>
<li>''string status()'' — string status of the transport.</li>
<li>''bool start( bool vl = EVAL, int tm = 0 )'' — returns the transport status "Running", starts/stops it by ''vl'' (if it is not EVAL). For starting you can set the specific timeout ''tm''.</li>
<li>''string addr( string vl = "" )'' — address of the transport, sets the non-empty value ''vl''.</li>
<li>''string timings( string vl = "", isDef = true )'' — timings of the transport, sets the non-empty value ''vl'' and as default one for ''isDef''.</li>
<li>''int attempts( int vl = EVAL )'' — attempts of the transport connection, sets the non-EVAL value ''vl''.</li>
<li>''ElTp conPrm( string id, ElTp val = EVAL, string cfg = "" )'' — common handling the connection time parameter ''id'' with setting to the value ''val'' at presence; request for configuration parameter of the connection time with registration at the first time from the configuration ''cfg'' in the form "{SRC}\n{NAME}\n{HELP}".</li>
<li>''bool setConPrm( string id, ElTp val )'' — setting the connection time parameter ''id'' to the value ''val'', only for compatibility.</li>
<li>''string messIO( string mess, real timeOut = 0, int inBufLen = -1 );'' — sends the message ''mess'' via the transport with the waiting time of the response ''timeOut'' (in seconds) and reads an response (Buffer) in ''inBufLen'' byte. In the case of a zero timeout, this time is taken from the settings of the output transport. The ''timeOut'' in negative (< -1e-3) disables the transport request/respond mode and allows for independent reading/writing to a buffer IO, with the reading timeout ''timeOut'' in absolute. For negative ''inBufLen'' the buffer size sets to STR_BUF_LEN(10000) and "0" disables the reading at all.<br/>
[[File:at.png]] If your transport means getting data in parts for a request then for several devices on single bus-transport, use the function into single thread but there is not a way to lock the transport into the user API. Single thread that is any object of controller of DAQ and [[Special:MyLanguage/Modules/UserProtocol|the module "User protocol"]] locks the transport internally before self user procedures execution.
<syntaxhighlight lang="JavaScript">
rez = SYS.Transport.Serial.out_ttyUSB0.messIO(SYS.strFromCharCode(0x4B,0x00,0x37,0x40),0.2);
//Wait for all the message tail by timeout and empty result
while((trez=SYS.Transport.Serial.out_ttyUSB0.messIO("")).length) rez += trez; </syntaxhighlight></li>
<li>''string messIO( XMLNodeObj req, string prt );'' — sends the request ''req'' to the protocol ''prt'' to perform a communication session through the transport and in assistance of the protocol. Returns a string with error in the format "'''{errCod}:{errText}'''" which empty for successful request.
<syntaxhighlight lang="JavaScript">
req = SYS.XMLNode("TCP");
req.setAttr("id","test").setAttr("reqTm",500).setAttr("node",1).setAttr("reqTry",2).setText(SYS.strFromCharCode(0x03,0x00,0x00,0x00,0x05));
SYS.Transport.Sockets.out_testModBus.messIO(req,"ModBus");
test = Special.FLibSYS.strDec4Bin(req.text()); </syntaxhighlight></li>
</ul>
 h Russian (ru)Функции объекта исходящего транспорта (SYS.Transport["Modul"]["out_Transp"]):
<ul>
<li>''bool isNetwork()'' — признак — "Транспорт сетевой", что определяет таймауты в секундах.</li>
<li>''ElTp cfg(string nm)'' — получает значение конфигурационного поля ''nm'' объекта.</li>
<li>''bool cfgSet(string nm, ElTp val)'' [<span style='color:red'>доступ к соответствующей подсистеме</span>] — устанавливает конфигурационное поле ''nm'' объекта в значение ''val''.</li>
<li>''string status()'' — строка статуса транспорта.</li>
<li>''bool start( bool vl = EVAL, int tm = 0 )'' — возвращает статус исполнения, запускает/останавливает по ''vl'' (если не <EVAL>). Для запуска можно указывать особый таймаут ''tm''.</li>
<li>''string addr( string vl = "" )'' — адрес транспорта, устанавливает в непустое значение ''vl''.</li>
<li>''string timings( string vl = "", isDef = true )'' — тайминги транспорта, устанавливает в непустое значение ''vl'' и по умолчанию для ''isDef''.</li>
<li>''int attempts( int vl = EVAL )'' — попыток подключения транспорта, устанавливает в не-EVAL значение ''vl''.</li>
<li>''string messIO( string mess, real timeOut = 0, int inBufLen = -1 );'' — отправляет сообщения ''mess'' через транспорт с таймаутом ожидания ответа ''timeOut'' (в секундах) и читает ответ (буфер) размером ''inBufLen'' байт. В случае нулевого таймаута это время берётся из настроек исходящего транспорта. Отрицательное время ''timeOut'' (< -1e-3) отключает работу транспорта в режиме запрос/ответ и позволяет независимо читать/писать в буфер ВВ, с таймаутом чтения ''timeOut'', в абсолютном значении. Для отрицательного ''inBufLen'' размер буфера устанавливается в STR_BUF_LEN(10000), а "0" выключает чтение вообще.<br/>
[[File:at.png]] Если Ваш транспорт в ответ на запрос подразумевает получение данных частями тогда используйте эту функцию в одном потоке для нескольких устройств на одной шине-транспорте поскольку здесь не существует способа блокирования транспорта из пользовательского API. Один поток это объект контроллера подсистемы "Сбор данных", а [[Special:MyLanguage/Modules/UserProtocol|модуль "Протокол пользователя"]] блокирует транспорт внутри перед выполнением своих пользовательских процедур.
<syntaxhighlight lang="JavaScript">
rez = SYS.Transport.Serial.out_ttyUSB0.messIO(SYS.strFromCharCode(0x4B,0x00,0x37,0x40),0.2);
//Wait for all the message tail by timeout and empty result
while((trez=SYS.Transport.Serial.out_ttyUSB0.messIO("")).length) rez += trez; </syntaxhighlight></li>
<li>''string messIO( XMLNodeObj req, string prt );'' — отправляет запрос ''req'' к протоколу ''prt'' для осуществления сеанса связи через транспорт посредством протокола.
<syntaxhighlight lang="JavaScript">
req = SYS.XMLNode("TCP");
req.setAttr("id","test").setAttr("reqTm",500).setAttr("node",1).setAttr("reqTry",2).setText(SYS.strFromCharCode(0x03,0x00,0x00,0x00,0x05));
SYS.Transport.Sockets.out_testModBus.messIO(req,"ModBus");
test = Special.FLibSYS.strDec4Bin(req.text()); </syntaxhighlight></li>
</ul>
 h Ukrainian (uk)Функції об'єкту вихідного транспорту (SYS.Transport["Modul"]["out_Transp"]):
<ul>
<li>''bool isNetwork()'' — ознака — "Транспорт мережевий", що визначає таймаути у секундах.</li>
<li>''ElTp cfg(string nm)'' — отримує значення конфігураційного поля ''nm'' об'єкту.</li>
<li>''bool cfgSet(string nm, ElTp val)'' [<span style='color:red'>доступ до відповідної підсистеми</span>] — встановлює конфігураційне поле ''nm'' об'єкту у значення ''val''.</li>
<li>''string status()'' — рядок статусу транспорту.</li>
<li>''bool start( bool vl = EVAL, int tm = 0 )'' — повертає статус "Виконання", запускає/зупиняє за ''vl'' (якщо не <EVAL>). Для запуску можна вказувати особливий таймаут ''tm''.</li>
<li>''string addr( string vl = "" )'' — адреса транспорту, встановлює у непорожнє значення ''vl''.</li>
<li>''string timings( string vl = "", isDef = true )'' — таймінги транспорту, встановлює у непорожнє значення ''vl'' та по замовченню для ''isDef''. </li>
<li>''int attempts( int vl = EVAL )'' — спроб підключень транспорту, встановлює у не-EVAL значення ''vl''.</li>
<li>''ElTp conPrm( string id, ElTp val = EVAL, string cfg = "" )'' — загальне поводження із параметром часу підключення ''id'' з встановленням у значення ''val'' за наявності; запит конфігураційного параметру часу підключення із реєстрацією конфігурації ''cfg'' у форматі "{SRC}\n{NAME}\n{HELP}" вперше.</li>
<li>''bool setConPrm( string id, ElTp val )'' — встановлення параметру часу підключення ''id'' у значення ''val'', лише для сумісності.</li>
<li>''string messIO( string mess, real timeOut = 0, int inBufLen = -1 );'' — відправляє повідомлення ''mess'' через транспорт з таймаутом очікування відповіді ''timeOut'' (у секундах) та читає відповідь (буфер) розміром ''inBufLen'' байт. У випадку нульового таймауту цей час береться з налаштувань вихідного транспорту. Негативний час ''timeOut'' (< -1e-3) вимикає роботу транспорту у режимі запит/відповідь та дозволяє незалежно читати/писати у буфер ВВ, з таймаутом читання ''timeOut'', у абсолютному значенні. Для негативного ''inBufLen'' розмір буферу встановлюється у STR_BUF_LEN(10000), а "0" вимикає читання взагалі.<br/>
[[File:at.png]] Якщо Ваш транспорт у відповідь на запит передбачає отримання даних частинами тоді використовуйте цю функцію у одному потоці для декількох пристроїв на одній шині-транспорті оскільки тут не існує способу блокування транспорту з користувацького API. Один потік це об'єкт контролеру підсистеми "Збір даних", а [[Special:MyLanguage/Modules/UserProtocol|модуль "Протокол користувача"]] блокує транспорт всередині, перед виконанням своїх користувацьких процедур.
<syntaxhighlight lang="JavaScript">
rez = SYS.Transport.Serial.out_ttyUSB0.messIO(SYS.strFromCharCode(0x4B,0x00,0x37,0x40),0.2);
//Wait for all the message tail by timeout and empty result
while((trez=SYS.Transport.Serial.out_ttyUSB0.messIO("")).length) rez += trez; </syntaxhighlight></li>
<li>''string messIO( XMLNodeObj req, string prt );'' — відправляє запити ''req'' до протоколу ''prt'' для здійснення сеансу зв'язку через транспорт за посередництвом протоколу. Повертає рядок із помилкою у форматі "'''{errCod}:{errText}'''", який порожній для успішного запиту.
<syntaxhighlight lang="JavaScript">
req = SYS.XMLNode("TCP");
req.setAttr("id","test").setAttr("reqTm",500).setAttr("node",1).setAttr("reqTry",2).setText(SYS.strFromCharCode(0x03,0x00,0x00,0x00,0x05));
SYS.Transport.Sockets.out_testModBus.messIO(req,"ModBus");
test = Special.FLibSYS.strDec4Bin(req.text()); </syntaxhighlight></li>
</ul>