Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | fix client connection handling in topcua subtree |
---|---|
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
839163987ae0377b6f76787f8147ba54 |
User & Date: | chw 2018-09-19 03:32:28.030 |
Context
2018-09-20
| ||
04:30 | update SQLite to version 3.25.1 check-in: e7414c6869 user: chw tags: trunk | |
2018-09-19
| ||
03:32 | fix client connection handling in topcua subtree check-in: 839163987a user: chw tags: trunk | |
2018-09-17
| ||
17:53 | update SQLite to version 3.25.0 check-in: c2fa0bf108 user: chw tags: trunk | |
Changes
Changes to jni/topcua/examples/client.tcl.
︙ | ︙ | |||
34 35 36 37 38 39 40 | # wait a while after 1000 # connect again opcua connect C opc.tcp://localhost:4840 puts stderr Reconnected | | | 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | # wait a while after 1000 # connect again opcua connect C opc.tcp://localhost:4840 puts stderr Reconnected # monitor callback proc proc monitor {data} { puts stderr "Monitor: $data" } # make a subscription set sub [opcua subscription C new 1 1000.0] |
︙ | ︙ |
Added jni/topcua/examples/uacam_client.tcl.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | # A little OPC/UA webcam client example package require Tk package require topcua wm title . "Client of LilWebCam" set img [image create photo] label .label -image $img pack .label # create client opcua new client C # connect to server opcua connect C opc.tcp://localhost:4840 # get the namespace set ns [opcua namespace C LilWebCam] # monitor callback proc proc monitor {data} { $::img configure -format png -data [dict get $data value] } # make a subscription with 200 ms rate set sub [opcua subscription C new 1 200.0] # make a monitor to the camera image set mon [opcua monitor C new $sub data monitor "ns=${ns};Image"] # handle OPC/UA traffic (the subscription/monitor) proc do_opcua_traffic {} { after cancel do_opcua_traffic if {[catch {opcua run C 20}]} { # this most likely is the server shutting down exit } after 200 do_opcua_traffic } do_opcua_traffic |
Changes to jni/topcua/topcua.c.
︙ | ︙ | |||
342 343 344 345 346 347 348 | { "HasAlarmSuppressionGroup", 16361 }, { "AlarmGroupMember", 16362 }, { "HasEffectDisable", 17276 }, { "HasEffectEnable", 17983 }, { "HasEffectSuppressed", 17984 }, { "HasEffectUnsuppressed", 17985 } }; | < < < < < < < < < < < < < | 342 343 344 345 346 347 348 349 350 351 352 353 354 355 | { "HasAlarmSuppressionGroup", 16361 }, { "AlarmGroupMember", 16362 }, { "HasEffectDisable", 17276 }, { "HasEffectEnable", 17983 }, { "HasEffectSuppressed", 17984 }, { "HasEffectUnsuppressed", 17985 } }; /* *------------------------------------------------------------------------- * * DoNotLog -- * * Silence log messages. |
︙ | ︙ | |||
460 461 462 463 464 465 466 | mon->dv = UA_DataValue_new(); if (mon->dv == NULL) { return; } UA_DataValue_copy(value, mon->dv); if (!mon->pending) { | < < < < < < | < < | 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 | mon->dv = UA_DataValue_new(); if (mon->dv == NULL) { return; } UA_DataValue_copy(value, mon->dv); if (!mon->pending) { mon->pending = 1; mon->sub->uah->pending += 1; Tcl_DoWhenIdle(MonIdleProc, (ClientData) mon); } } /* *------------------------------------------------------------------------- * |
︙ | ︙ | |||
512 513 514 515 516 517 518 | &UA_TYPES[UA_TYPES_VARIANT]); if (uaret != UA_STATUSCODE_GOOD) { return; } mon->vvSize = nevt; if (!mon->pending) { | < < < < < < | < < | 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 | &UA_TYPES[UA_TYPES_VARIANT]); if (uaret != UA_STATUSCODE_GOOD) { return; } mon->vvSize = nevt; if (!mon->pending) { mon->pending = 1; mon->sub->uah->pending += 1; Tcl_DoWhenIdle(MonIdleProc, (ClientData) mon); } } /* *------------------------------------------------------------------------- * |
︙ | ︙ | |||
549 550 551 552 553 554 555 | static void MonIdleProc(ClientData clientData) { UAM *mon = (UAM *) clientData; UAH *uah = mon->sub->uah; UAI *uai = uah->uai; | < | < < < < < < < | 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 | static void MonIdleProc(ClientData clientData) { UAM *mon = (UAM *) clientData; UAH *uah = mon->sub->uah; UAI *uai = uah->uai; Tcl_InterpState state; int i, ret, nCmdObjs; Tcl_Obj **cmdObjs; mon->pending = 0; uah->pending -= 1; Tcl_Preserve(uai); Tcl_Preserve(uah); Tcl_Preserve(uah->interp); state = Tcl_SaveInterpState(uah->interp, TCL_OK); nCmdObjs = mon->nCmdObjs; cmdObjs = mon->cmdObjs; mon->nCmdObjs = 0; |
︙ | ︙ | |||
664 665 666 667 668 669 670 | ms = 10; } else if (ms > 500) { ms = 500; } uah->timer = Tcl_CreateTimerHandler(ms, RunServer, clientData); } | < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 627 628 629 630 631 632 633 634 635 636 637 638 639 640 | ms = 10; } else if (ms > 500) { ms = 500; } uah->timer = Tcl_CreateTimerHandler(ms, RunServer, clientData); } /* *------------------------------------------------------------------------- * * ReleaseSubCB -- * * Deletion callback for a subscription. * |
︙ | ︙ | |||
934 935 936 937 938 939 940 | *------------------------------------------------------------------------- */ static void DisconnectClient(UAH *uah) { if (uah->connected) { | < < < | 869 870 871 872 873 874 875 876 877 878 879 880 881 882 | *------------------------------------------------------------------------- */ static void DisconnectClient(UAH *uah) { if (uah->connected) { UA_Client_disconnect(uah->client); ReleaseSubs(uah); uah->connected = 0; } } static void |
︙ | ︙ | |||
3916 3917 3918 3919 3920 3921 3922 | Tcl_GetString(objv[3]), Tcl_GetString(objv[4])); } if (uaret != UA_STATUSCODE_GOOD) { ReportError(interp, uai, "ClientConnect", uaret); return TCL_ERROR; } | < < < < | 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 | Tcl_GetString(objv[3]), Tcl_GetString(objv[4])); } if (uaret != UA_STATUSCODE_GOOD) { ReportError(interp, uai, "ClientConnect", uaret); return TCL_ERROR; } uah->connected = 1; return TCL_OK; } /* *------------------------------------------------------------------------- * |
︙ | ︙ |