Method: OPCUA::Server::Node#description=

Defined in:
ext/opcua/server/server.c

#description=(value) ⇒ Object

{{{



888
889
890
891
892
893
894
895
896
897
898
899
900
901
# File 'ext/opcua/server/server.c', line 888

static VALUE node_description_set(VALUE self, VALUE value) { //{{{
  node_struct *ns;
  Data_Get_Struct(self, node_struct, ns);
  if (!ns->exists) rb_raise(rb_eRuntimeError, "Node does not exist anymore.");

  VALUE str = rb_obj_as_string(value);
  if (NIL_P(str) || TYPE(str) != T_STRING)
    rb_raise(rb_eTypeError, "cannot convert obj to string");
  char *nstr = (char *)StringValuePtr(str);
  UA_LocalizedText lt = UA_LOCALIZEDTEXT("en-US",nstr);

  UA_Server_writeDescription(ns->master->master, ns->id, lt);
  return self;
}