Class: OPCUA::Server::Node
- Inherits:
-
Object
- Object
- OPCUA::Server::Node
- Defined in:
- ext/opcua/server/server.c
Direct Known Subclasses
ObjectMethodNode, ObjectNode, ObjectReferenceNode, ObjectVarNode, ReferenceSubNode, ReferenceTopNode, TypeSubNode, TypeTopNode
Instance Method Summary collapse
-
#description ⇒ Object
{{{.
-
#description=(value) ⇒ Object
{{{.
-
#id ⇒ Object
{{{.
-
#to_s ⇒ Object
{{{.
Instance Method Details
#description ⇒ Object
{{{
756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 |
# File 'ext/opcua/server/server.c', line 756 static VALUE node_description(VALUE self) { //{{{ node_struct *ns; Data_Get_Struct(self, node_struct, ns); UA_LocalizedText value; UA_LocalizedText_init(&value); UA_StatusCode retval = UA_Server_readDescription(ns->master->master, ns->id, &value); VALUE ret = Qnil; if (retval == UA_STATUSCODE_GOOD) { ret = rb_str_export_locale(rb_str_new((char *)(value.text.data),value.text.length)); } UA_LocalizedText_clear(&value); return ret; } |
#description=(value) ⇒ Object
{{{
743 744 745 746 747 748 749 750 751 752 753 754 755 |
# File 'ext/opcua/server/server.c', line 743 static VALUE node_description_set(VALUE self, VALUE value) { //{{{ node_struct *ns; Data_Get_Struct(self, node_struct, ns); 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; } |
#id ⇒ Object
{{{
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'ext/opcua/server/server.c', line 103 static VALUE node_id(VALUE self) { //{{{ node_struct *ns; Data_Get_Struct(self, node_struct, ns); VALUE ret = rb_ary_new(); rb_ary_push(ret,UINT2NUM(ns->id.namespaceIndex)); if (ns->id.identifierType == UA_NODEIDTYPE_NUMERIC) { VALUE id = UINT2NUM((UA_UInt32)(ns->id.identifier.numeric)); rb_ary_push(ret,id); } else if (ns->id.identifierType == UA_NODEIDTYPE_STRING) { rb_ary_push(ret,rb_str_new((const char *)ns->id.identifier.string.data,ns->id.identifier.string.length)); } else if (ns->id.identifierType == UA_NODEIDTYPE_BYTESTRING) { rb_ary_push(ret,rb_str_new((const char *)ns->id.identifier.byteString.data,ns->id.identifier.byteString.length)); } return ret; } |
#to_s ⇒ Object
{{{
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
# File 'ext/opcua/server/server.c', line 121 static VALUE node_to_s(VALUE self) { //{{{ node_struct *ns; VALUE ret; Data_Get_Struct(self, node_struct, ns); if (ns->id.identifierType == UA_NODEIDTYPE_NUMERIC) { ret = rb_sprintf("ns=%d;i=%d", ns->id.namespaceIndex, ns->id.identifier.numeric); } else if(ns->id.identifierType == UA_NODEIDTYPE_STRING) { ret = rb_sprintf("ns=%d;s=%.*s", ns->id.namespaceIndex, (int)ns->id.identifier.string.length, ns->id.identifier.string.data); } else { ret = rb_sprintf("ns=%d;unsupported",ns->id.namespaceIndex); } return ret; } |