Skip to content
abinition edited this page Oct 1, 2014 · 2 revisions

SECS/GEM Clients (Host) and Servers (Equipment)

HS supports SECS1 over serial and TCP terminal server connections, as well as HSMS over TCP.

Opening the connection

Examples

SECS1 Serial Host

  handle COM = secs_open ( "COM7:" , 9600) ;
  int SECS_ID = 1 ;
  secs_assign ( SECS_ID, COM, 1 ) ;

SECS1 Serial Equipment

  handle COM = secs_open ( "COM1:" , 19200) ;
  int SECS_ID = 1 ;
  secs_assign ( SECS_ID, COM ) ;

SECS1 TCP Host

  handle COM = secs_open ( "192.168.11.99", 3001 ) ;
  int SECS_ID = 1 ;
  secs_assign ( SECS_ID, COM, 1 ) ;

SECS1 TCP Equipment

  handle COM = secs_service ( 3001 ) ;
  int SECS_ID = 1 ;
  secs_assign ( SECS_ID, COM ) ;

HSMS Host

  handle COM = secs_open ( "192.168.11.10", 5000 ) ;
  int SECS_ID = 1 ;
  secs_assign ( SECS_ID, COM, 1 ) ;

HSMS Equipment

  handle COM = secs_hsms ( 5000 ) ;
  int SECS_ID = 1 ;
  secs_assign ( SECS_ID, COM, 1 ) ;

Enabling incoming methods

Example:

SECS_S1F13() {
  describe S1F13 ;
  list S1F14 = {
	char MDLN = "hyperscript",
	char REV = version()
  } ;
  global S1F14 ;
} ;
secs_enable ( SECS_S1F13, 1,1,13 ) ;

SECS_S6F3() {
  describe S6F3 ;
  binary S6F4 = 0 ;
  global S6F4 ;
} ;
secs_enable ( SECS_S6F11, 1,6,11 ) ;

Sending SECS Events and Queries

Example:

   list S1F13 = {
      binary go = 1,
      list x = {
        char mdln = "Host",
        char ver = "0.9"
      }
    } ;

    timeout 30 ;
    ret = secs_query ( SECS_ID, 1, 13, S1F13 ) ;
    if ( !ret ) puts ret ;
    if ( exists ( S1F14 ) ) describe S1F14 ;
  list S6F3 = {
    ushort DATAID = 1,
    ushort CEID = 99,
    list data = {
      binary data = {0,1,2,3,4,5,6,7,8,9}
    }
  } ;
  describe S6F3 ;
  ret = secs_event ( SECS_ID, 6, 3, S6F3 ) ;
Clone this wiki locally