Class: OPCUA::Client::cNode
- Inherits:
-
Object
- Object
- OPCUA::Client::cNode
- Defined in:
- ext/opcua/client/client.c
Direct Known Subclasses
Instance Method Summary collapse
-
#id ⇒ Object
{{{.
-
#to_s ⇒ Object
{{{.
Instance Method Details
#id ⇒ Object
{{{
461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 |
# File 'ext/opcua/client/client.c', line 461 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
{{{
479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 |
# File 'ext/opcua/client/client.c', line 479 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; } |