├── README.md ├── WSDL ├── devicemgmt-mod.wsdl ├── media-mod.wsdl ├── onvif.xsd └── ptz-mod.wsdl └── inc ├── ONVIF.inc.php ├── ONVIFDevicemgmt.inc.php ├── ONVIFMedia.inc.php └── ONVIFPTZ.inc.php /README.md: -------------------------------------------------------------------------------- 1 | ONVIF client library classes 2 | 3 | ONVIFDevicemgmt 4 | 5 | The class uses slightly modified devicemgmt.wsdl where endpoint is defined and the reference to onvif.xsd is fixed. 6 | The endpoint is overwritten with the parameter but it is still needed 7 | 8 | example: 9 | ```php 10 | include( 'inc/ONVIFDevicemgmt.inc.php' ); 11 | ini_set( 'default_socket_timeout', 1800 ); 12 | $wsdl = 'http://localhost/WSDL/devicemgmt-mod.wsdl'; 13 | $service = 'http://192.168.0.1:888/onvif/device_service'; 14 | $username = 'username'; 15 | $password = 'password'; 16 | $client = new ONVIFDevicemgmt( $wsdl, $service, $username, $password); 17 | try { 18 | $res = $client->get_network_interfaces(); 19 | var_dump( $res ); 20 | } catch ( Exception $e ) { 21 | print "SOAP error occured\n"; 22 | $res = $client->client->__getLastRequest(); 23 | print "Last request:\n"; 24 | print( $res . "\n" ); 25 | $res = $client->client->__getLastResponse(); 26 | print "Last response:\n"; 27 | print( $res . "\n"); 28 | } 29 | ``` 30 | 31 | ONVIF PTZ client library class 32 | 33 | The class uses slightly modified ptz.wsdl where endpoint is defined and the reference to onvif.xsd is fixed. 34 | The endpoint is overwritten with the parameter but it is still needed 35 | 36 | ```php 37 | include( 'inc/ONVIFPTZ.inc.php' ); 38 | ini_set( 'default_socket_timeout', 1800 ); 39 | $wsdl = 'http://localhost/WSDL/ptz-mod.wsdl'; 40 | $service = 'http://192.168.0.1:888/onvif/device_service'; 41 | $username = 'username'; 42 | $password = 'password'; 43 | $client = new ONVIFPTZ( $wsdl, $service, $username, $password); 44 | try { 45 | $client->response_dump( 'GetServiceCapabilities', $client->get_service_capabilities() ); 46 | $client->response_dump( 'GetNodes', $client->get_nodes() ); 47 | $client->response_dump( 'GetNode', $client->get_node('ptz0') ); 48 | $client->response_dump( 'GetConfigurations', $client->get_configurations() ); 49 | $client->response_dump( 'GetConfiguration', $client->get_configuration('ptzconf0') ); 50 | $client->response_dump( 'GetConfigurationOptions', $client->get_configuration_options('ptzconf0') ); 51 | } catch ( Exception $e ) { 52 | print "SOAP error occured\n"; 53 | $res = $client->client->__getLastRequest(); 54 | print "Last request:\n"; 55 | print( $res . "\n" ); 56 | $res = $client->client->__getLastResponse(); 57 | print "Last response:\n"; 58 | print( $res . "\n"); 59 | } 60 | ``` 61 | 62 | 63 | ONVIF Media client library class 64 | 65 | The class uses slightly modified media.wsdl where endpoint is defined and 66 | the reference to onvif.xsd is fixed. The endpoint is overwritten with the 67 | parameter but it is still needed 68 | 69 | ```php 70 | include( 'inc/ONVIFMedia.inc.php' ); 71 | ini_set( 'default_socket_timeout', 1800 ); 72 | $wsdl = 'http://localhost/WSDL/media-mod.wsdl'; 73 | $service = 'http://192.168.0.1:888/onvif/device_service'; 74 | $username = 'username'; 75 | $password = 'password'; 76 | $client = new ONVIFMedia( $wsdl, $service, $username, $password); 77 | try { 78 | $client->response_dump( 'GetProfiles', $client->get_profiles() ); 79 | } catch ( Exception $e ) { 80 | print "SOAP error occured\n"; 81 | $res = $client->client->__getLastRequest(); 82 | print "Last request:\n"; 83 | print( $res . "\n" ); 84 | $res = $client->client->__getLastResponse(); 85 | print "Last response:\n"; 86 | print( $res . "\n"); 87 | } 88 | ``` 89 | -------------------------------------------------------------------------------- /WSDL/ptz-mod.wsdl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | The capabilities for the PTZ service is returned in the Capabilities element. 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | Indicates whether or not EFlip is supported. 41 | 42 | 43 | 44 | 45 | Indicates whether or not reversing of PT control direction is supported. 46 | 47 | 48 | 49 | 50 | Indicates support for the GetCompatibleConfigurations command. 51 | 52 | 53 | 54 | 55 | Indicates that the PTZVector includes MoveStatus information. 56 | 57 | 58 | 59 | 60 | Indicates that the PTZVector includes Position information. 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | A list of the existing PTZ Nodes on the device. 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | Token of the requested PTZNode. 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | A requested PTZNode. 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | A list of all existing PTZConfigurations on the device. 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | Token of the requested PTZConfiguration. 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | A requested PTZConfiguration. 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | Flag that makes configuration persistent. Example: User wants the configuration to exist after reboot. 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | Token of an existing configuration that the options are intended for. 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | The requested PTZ configuration options. 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | A reference to the MediaProfile where the operation should take place. 204 | 205 | 206 | 207 | 208 | 209 | The Auxiliary request data. 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | The response contains the auxiliary response. 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | A reference to the MediaProfile where the operation should take place. 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | A list of presets which are available for the requested MediaProfile. 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | A reference to the MediaProfile where the operation should take place. 260 | 261 | 262 | 263 | 264 | 265 | A requested preset name. 266 | 267 | 268 | 269 | 270 | 271 | A requested preset token. 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | A token to the Preset which has been set. 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | A reference to the MediaProfile where the operation should take place. 297 | 298 | 299 | 300 | 301 | 302 | A requested preset token. 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | A reference to the MediaProfile where the operation should take place. 319 | 320 | 321 | 322 | 323 | 324 | A requested preset token. 325 | 326 | 327 | 328 | 329 | 330 | A requested speed.The speed parameter can only be specified when Speed Spaces are available for the PTZ Node. 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | A reference to the MediaProfile where the PTZStatus should be requested. 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | The PTZStatus for the requested MediaProfile. 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | A reference to the MediaProfile where the operation should take place. 372 | 373 | 374 | 375 | 376 | 377 | A requested speed.The speed parameter can only be specified when Speed Spaces are available for the PTZ Node. 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | A reference to the MediaProfile where the home position should be set. 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | A reference to the MediaProfile. 414 | 415 | 416 | 417 | 418 | 419 | A Velocity vector specifying the velocity of pan, tilt and zoom. 420 | 421 | 422 | 423 | 424 | 425 | An optional Timeout parameter. 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | A reference to the MediaProfile. 444 | 445 | 446 | 447 | 448 | 449 | A positional Translation relative to the current position 450 | 451 | 452 | 453 | 454 | 455 | An optional Speed parameter. 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | A reference to the MediaProfile. 474 | 475 | 476 | 477 | 478 | 479 | A Position vector specifying the absolute target position. 480 | 481 | 482 | 483 | 484 | 485 | An optional Speed. 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | A reference to the MediaProfile that indicate what should be stopped. 504 | 505 | 506 | 507 | 508 | 509 | Set true when we want to stop ongoing pan and tilt movements.If PanTilt arguments are not present, this command stops these movements. 510 | 511 | 512 | 513 | 514 | 515 | Set true when we want to stop ongoing zoom movement.If Zoom arguments are not present, this command stops ongoing zoom movement. 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 | 534 | 535 | 536 | 537 | 538 | 539 | 540 | 541 | 542 | 543 | 544 | 545 | 546 | 547 | 548 | 549 | 550 | 551 | 552 | 553 | 554 | 555 | 556 | 557 | 558 | 559 | 560 | 561 | 562 | 563 | 564 | 565 | 566 | 567 | 568 | 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | Contains the token of an existing media profile the configurations shall be compatible with. 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | A list of all existing PTZConfigurations on the NVT that is suitable to be added to the addressed media profile. 650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | 665 | 666 | 667 | 668 | 669 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | 678 | 679 | 680 | 681 | 682 | 683 | 684 | 685 | 686 | 687 | 688 | 689 | 690 | 691 | 692 | 693 | 694 | 695 | 696 | 697 | 698 | 699 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 724 | 725 | 726 | 727 | 728 | 729 | 730 | 731 | 732 | 733 | 734 | 735 | 736 | 737 | 738 | 739 | 740 | 741 | 742 | 743 | 744 | 745 | 746 | 747 | 748 | 749 | 750 | 751 | 752 | 753 | 754 | 755 | 756 | 757 | 758 | 759 | 760 | 761 | 762 | 763 | 764 | 765 | 766 | 767 | 768 | 769 | 770 | 771 | 772 | 773 | 774 | 775 | 776 | 777 | 778 | 779 | 780 | 781 | 782 | 783 | 784 | 785 | 786 | 787 | 788 | 789 | 790 | 791 | 792 | 793 | 794 | 795 | 796 | 797 | 798 | 799 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | Returns the capabilities of the PTZ service. The result is returned in a typed answer. 824 | 825 | 826 | 827 | 828 | 829 | Get the descriptions of the available PTZ Nodes. 830 |
831 | A PTZ-capable device may have multiple PTZ Nodes. The PTZ Nodes may represent 832 | mechanical PTZ drivers, uploaded PTZ drivers or digital PTZ drivers. PTZ Nodes are the 833 | lowest level entities in the PTZ control API and reflect the supported PTZ capabilities. The 834 | PTZ Node is referenced either by its name or by its reference token. 835 |
836 | 837 | 838 |
839 | 840 | Get a specific PTZ Node identified by a reference 841 | token or a name. 842 | 843 | 844 | 845 | 846 | 847 | Get a specific PTZonfiguration from the device, identified by its reference token or name. 848 |
849 | The default Position/Translation/Velocity Spaces are introduced to allow NVCs sending move 850 | requests without the need to specify a certain coordinate system. The default Speeds are 851 | introduced to control the speed of move requests (absolute, relative, preset), where no 852 | explicit speed has been set.
853 | The allowed pan and tilt range for Pan/Tilt Limits is defined by a two-dimensional space range 854 | that is mapped to a specific Absolute Pan/Tilt Position Space. At least one Pan/Tilt Position 855 | Space is required by the PTZNode to support Pan/Tilt limits. The limits apply to all supported 856 | absolute, relative and continuous Pan/Tilt movements. The limits shall be checked within the 857 | coordinate system for which the limits have been specified. That means that even if 858 | movements are specified in a different coordinate system, the requested movements shall be 859 | transformed to the coordinate system of the limits where the limits can be checked. When a 860 | relative or continuous movements is specified, which would leave the specified limits, the PTZ 861 | unit has to move along the specified limits. The Zoom Limits have to be interpreted 862 | accordingly. 863 |
864 | 865 | 866 |
867 | 868 | 869 | Get all the existing PTZConfigurations from the device. 870 |
871 | The default Position/Translation/Velocity Spaces are introduced to allow NVCs sending move 872 | requests without the need to specify a certain coordinate system. The default Speeds are 873 | introduced to control the speed of move requests (absolute, relative, preset), where no 874 | explicit speed has been set.
875 | The allowed pan and tilt range for Pan/Tilt Limits is defined by a two-dimensional space range 876 | that is mapped to a specific Absolute Pan/Tilt Position Space. At least one Pan/Tilt Position 877 | Space is required by the PTZNode to support Pan/Tilt limits. The limits apply to all supported 878 | absolute, relative and continuous Pan/Tilt movements. The limits shall be checked within the 879 | coordinate system for which the limits have been specified. That means that even if 880 | movements are specified in a different coordinate system, the requested movements shall be 881 | transformed to the coordinate system of the limits where the limits can be checked. When a 882 | relative or continuous movements is specified, which would leave the specified limits, the PTZ 883 | unit has to move along the specified limits. The Zoom Limits have to be interpreted 884 | accordingly. 885 |
886 | 887 | 888 |
889 | 890 | 891 | Set/update a existing PTZConfiguration on the device. 892 | 893 | 894 | 895 | 896 | 897 | 898 | List supported coordinate systems including their range limitations. Therefore, the options 899 | MAY differ depending on whether the PTZ Configuration is assigned to a Profile containing a 900 | Video Source Configuration. In that case, the options may additionally contain coordinate 901 | systems referring to the image coordinate system described by the Video Source 902 | Configuration. If the PTZ Node supports continuous movements, it shall return a Timeout Range within 903 | which Timeouts are accepted by the PTZ Node. 904 | 905 | 906 | 907 | 908 | 909 | 910 | Operation to send auxiliary commands to the PTZ device 911 | mapped by the PTZNode in the selected profile. The 912 | operation is supported 913 | if the AuxiliarySupported element of the PTZNode is true 914 | 915 | 916 | 917 | 918 | 919 | 920 | Operation to request all PTZ presets for the PTZNode 921 | in the selected profile. The operation is supported if there is support 922 | for at least on PTZ preset by the PTZNode. 923 | 924 | 925 | 926 | 927 | 928 | The SetPreset command saves the current device position parameters so that the device can 929 | move to the saved preset position through the GotoPreset operation. 930 | In order to create a new preset, the SetPresetRequest contains no PresetToken. If creation is 931 | successful, the Response contains the PresetToken which uniquely identifies the Preset. An 932 | existing Preset can be overwritten by specifying the PresetToken of the corresponding Preset. 933 | In both cases (overwriting or creation) an optional PresetName can be specified. The 934 | operation fails if the PTZ device is moving during the SetPreset operation. 935 | The device MAY internally save additional states such as imaging properties in the PTZ 936 | Preset which then should be recalled in the GotoPreset operation. 937 | 938 | 939 | 940 | 941 | 942 | Operation to remove a PTZ preset for the Node in 943 | the 944 | selected profile. The operation is supported if the 945 | PresetPosition 946 | capability exists for teh Node in the 947 | selected profile. 948 | 949 | 950 | 951 | 952 | 953 | 954 | Operation to go to a saved preset position for the 955 | PTZNode in the selected profile. The operation is supported if there is 956 | support for at least on PTZ preset by the PTZNode. 957 | 958 | 959 | 960 | 961 | 962 | Operation to move the PTZ device to it's "home" position. The operation is supported if the HomeSupported element in the PTZNode is true. 963 | 964 | 965 | 966 | 967 | Operation to save current position as the home position. 968 | The SetHomePosition command returns with a failure if the “home” position is fixed and 969 | cannot be overwritten. If the SetHomePosition is successful, it is possible to recall the 970 | Home Position with the GotoHomePosition command. 971 | 972 | 973 | 974 | 975 | Operation for continuous Pan/Tilt and Zoom movements. The operation is supported if the PTZNode supports at least one continuous Pan/Tilt or Zoom space. If the space argument is omitted, the default space set by the PTZConfiguration will be used. 976 | 977 | 978 | 979 | 980 | Operation for Relative Pan/Tilt and Zoom Move. The operation is supported if the PTZNode supports at least one relative Pan/Tilt or Zoom space.
981 | The speed argument is optional. If an x/y speed value is given it is up to the device to either use 982 | the x value as absolute resoluting speed vector or to map x and y to the component speed. 983 | If the speed argument is omitted, the default speed set by the PTZConfiguration will be used. 984 |
985 | 986 | 987 |
988 | 989 | 990 | Operation to request PTZ status for the Node in the 991 | selected profile. 992 | 993 | 994 | 995 | 996 | Operation to move pan,tilt or zoom to a absolute destination.
997 | The speed argument is optional. If an x/y speed value is given it is up to the device to either use 998 | the x value as absolute resoluting speed vector or to map x and y to the component speed. 999 | If the speed argument is omitted, the default speed set by the PTZConfiguration will be used. 1000 |
1001 | 1002 | 1003 |
1004 | 1005 | Operation to stop ongoing pan, tilt and zoom movements of absolute relative and continuous type. 1006 | If no stop argument for pan, tilt or zoom is set, the device will stop all ongoing pan, tilt and zoom movements. 1007 | 1008 | 1009 | 1010 | 1011 | Operation to request PTZ preset tours in the selected media profiles. 1012 | 1013 | 1014 | 1015 | 1016 | Operation to request a specific PTZ preset tour in the selected media profile. 1017 | 1018 | 1019 | 1020 | 1021 | Operation to request available options to configure PTZ preset tour. 1022 | 1023 | 1024 | 1025 | 1026 | Operation to create a preset tour for the selected media profile. 1027 | 1028 | 1029 | 1030 | 1031 | Operation to modify a preset tour for the selected media profile. 1032 | 1033 | 1034 | 1035 | 1036 | Operation to perform specific operation on the preset tour in selected media profile. 1037 | 1038 | 1039 | 1040 | 1041 | Operation to delete a specific preset tour from the media profile. 1042 | 1043 | 1044 | 1045 | 1046 | Operation to get all available PTZConfigurations that can be added to the referenced media profile.
1047 | A device providing more than one PTZConfiguration or more than one VideoSourceConfiguration or which has any other resource 1048 | interdependency between PTZConfiguration entities and other resources listable in a media profile should implement this operation. 1049 | PTZConfiguration entities returned by this operation shall not fail on adding them to the referenced media profile. 1050 |
1051 | 1052 | 1053 |
1054 |
1055 | 1056 | 1057 | 1058 | 1059 | 1060 | 1061 | 1062 | 1063 | 1064 | 1065 | 1066 | 1067 | 1068 | 1069 | 1070 | 1071 | 1072 | 1073 | 1074 | 1075 | 1076 | 1077 | 1078 | 1079 | 1080 | 1081 | 1082 | 1083 | 1084 | 1085 | 1086 | 1087 | 1088 | 1089 | 1090 | 1091 | 1092 | 1093 | 1094 | 1095 | 1096 | 1097 | 1098 | 1099 | 1100 | 1101 | 1102 | 1103 | 1104 | 1105 | 1106 | 1107 | 1108 | 1109 | 1110 | 1111 | 1112 | 1113 | 1114 | 1115 | 1116 | 1117 | 1118 | 1119 | 1120 | 1121 | 1122 | 1123 | 1124 | 1125 | 1126 | 1127 | 1128 | 1129 | 1130 | 1131 | 1132 | 1133 | 1134 | 1135 | 1136 | 1137 | 1138 | 1139 | 1140 | 1141 | 1142 | 1143 | 1144 | 1145 | 1146 | 1147 | 1148 | 1149 | 1150 | 1151 | 1152 | 1153 | 1154 | 1155 | 1156 | 1157 | 1158 | 1159 | 1160 | 1161 | 1162 | 1163 | 1164 | 1165 | 1166 | 1167 | 1168 | 1169 | 1170 | 1171 | 1172 | 1173 | 1174 | 1175 | 1176 | 1177 | 1178 | 1179 | 1180 | 1181 | 1182 | 1183 | 1184 | 1185 | 1186 | 1187 | 1188 | 1189 | 1190 | 1191 | 1192 | 1193 | 1194 | 1195 | 1196 | 1197 | 1198 | 1199 | 1200 | 1201 | 1202 | 1203 | 1204 | 1205 | 1206 | 1207 | 1208 | 1209 | 1210 | 1211 | 1212 | 1213 | 1214 | 1215 | 1216 | 1217 | 1218 | 1219 | 1220 | 1221 | 1222 | 1223 | 1224 | 1225 | 1226 | 1227 | 1228 | 1229 | 1230 | 1231 | 1232 | 1233 | 1234 | 1235 | 1236 | 1237 | 1238 | 1239 | 1240 | 1241 | 1242 | 1243 | 1244 | 1245 | 1246 | 1247 | 1248 | 1249 | 1250 | 1251 | 1252 | 1253 | 1254 | 1255 | 1256 | 1257 | 1258 | 1259 | 1260 | 1261 | 1262 | 1263 | 1264 | 1265 | 1266 | 1267 | 1268 | 1269 | 1270 | 1271 | 1272 | 1273 | 1274 | 1275 | 1276 | 1277 | 1278 | 1279 | 1280 | 1281 | 1282 | 1283 | 1284 | 1285 | 1286 | 1287 | 1288 | 1289 | 1290 | 1291 | 1292 | 1294 | 1295 | 1296 | 1297 | 1298 | 1299 | 1300 | 1301 | 1302 | 1303 | 1304 | 1305 | 1306 | 1307 |
1308 | -------------------------------------------------------------------------------- /inc/ONVIF.inc.php: -------------------------------------------------------------------------------- 1 | 7 | * @version 0.1 8 | */ 9 | 10 | /** 11 | * The ONVIF class 12 | * 13 | * Contains some needed functions it is used by the other classes. Not to be used directly. 14 | */ 15 | class ONVIF { 16 | public $wsdl; 17 | public $version; 18 | protected $login; 19 | public $client; 20 | 21 | /** 22 | * If you have troubles authorizing try syncing the time with the camera... 23 | * and crazy as it sounds - capitalizing the first letter of the username 24 | * 25 | * @param string $wsdl URL for the modified devicemgmt.wsdl WSDL included with the library 26 | * @param string $service Camera ONVIF URL 27 | * @param string $username Camera username 28 | * @param string $password Camera password 29 | */ 30 | public function __construct( $wsdl, $service, $username, $password ) { 31 | $this->wsdl = $wsdl; 32 | 33 | $this->client = new SoapClient($this->wsdl, array( 34 | 'trace' => 1, 35 | 'exceptions' => true, 36 | # 'cache_wsdl' => WSDL_CACHE_NONE, 37 | 'ssl' => array( 38 | 'verify_peer' => false, 39 | 'allow_self_signed' => true 40 | ), 41 | 'soap_version' => SOAP_1_2, 42 | )); 43 | $this->client->__setLocation($service); 44 | 45 | # unfortunately this extra can be used only in devicemgmt 46 | if ( get_called_class() == 'ONVIFDevicemgmt' ) { 47 | $camera_datetime = $this->get_system_date_and_time(); 48 | $camera_ts = gmmktime( 49 | $camera_datetime->SystemDateAndTime->UTCDateTime->Time->Hour, 50 | $camera_datetime->SystemDateAndTime->UTCDateTime->Time->Minute, 51 | $camera_datetime->SystemDateAndTime->UTCDateTime->Time->Second, 52 | $camera_datetime->SystemDateAndTime->UTCDateTime->Date->Month, 53 | $camera_datetime->SystemDateAndTime->UTCDateTime->Date->Day, 54 | $camera_datetime->SystemDateAndTime->UTCDateTime->Date->Year 55 | ); 56 | $this->client->__setSoapHeaders($this->soapClientWSSecurityHeader($username,$password, $camera_ts)); 57 | } else { 58 | $this->client->__setSoapHeaders($this->soapClientWSSecurityHeader($username,$password)); 59 | } 60 | return; 61 | } 62 | 63 | protected function soapClientWSSecurityHeader($user, $password, $ts = 0) { 64 | if ( $ts == 0 ) { 65 | $ts = time(); 66 | } 67 | // Creating date using yyyy-mm-ddThh:mm:ssZ format 68 | $tm_created = gmdate('Y-m-d\TH:i:s\Z', $ts ); 69 | # $tm_expires = gmdate('Y-m-d\TH:i:s\Z', $ts + 180 ); //only necessary if using the timestamp element 70 | 71 | // Generating and encoding a random number 72 | $simple_nonce = mt_rand(); 73 | $encoded_nonce = base64_encode($simple_nonce); 74 | 75 | // Compiling WSS string 76 | $passdigest = base64_encode(sha1($simple_nonce . $tm_created . $password, true)); 77 | 78 | // Initializing namespaces 79 | $ns_wsse = 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd'; 80 | $ns_wsu = 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd'; 81 | $password_type = 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest'; 82 | $encoding_type = 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary'; 83 | 84 | // Creating WSS identification header using SimpleXML 85 | $root = new SimpleXMLElement(''); 86 | 87 | $security = $root->addChild('wsse:Security', null, $ns_wsse); 88 | 89 | //the timestamp element is not required by all servers 90 | $timestamp = $security->addChild('wsu:Timestamp', null, $ns_wsu); 91 | $timestamp->addAttribute('wsu:Id', 'Timestamp-28'); 92 | $timestamp->addChild('wsu:Created', $tm_created, $ns_wsu); 93 | # $timestamp->addChild('wsu:Expires', $tm_expires, $ns_wsu); 94 | 95 | $usernameToken = $security->addChild('wsse:UsernameToken', null, $ns_wsse); 96 | $usernameToken->addChild('wsse:Username', $user, $ns_wsse); 97 | $usernameToken->addChild('wsse:Password', $passdigest, $ns_wsse)->addAttribute('Type', $password_type); 98 | $usernameToken->addChild('wsse:Nonce', $encoded_nonce, $ns_wsse)->addAttribute('EncodingType', $encoding_type); 99 | $usernameToken->addChild('wsu:Created', $tm_created, $ns_wsu); 100 | 101 | // Recovering XML value from that object 102 | $root->registerXPathNamespace('wsse', $ns_wsse); 103 | $full = $root->xpath('/root/wsse:Security'); 104 | $auth = $full[0]->asXML(); 105 | 106 | return new SoapHeader($ns_wsse, 'Security', new SoapVar($auth, XSD_ANYXML), true); 107 | } 108 | 109 | function obj_dump($object, $level = 1) { 110 | foreach( $object as $okey => $oval ) { 111 | if ( is_array( $oval ) or is_object( $oval ) ) { 112 | for( $i = 0; $i < $level * 3; $i++ ) { 113 | print " "; 114 | } 115 | print $okey."\n"; 116 | $this->obj_dump( $oval, $level + 1 ); 117 | } elseif( is_bool($oval) ) { 118 | for( $i = 0; $i < $level * 3; $i++ ) { 119 | print " "; 120 | } 121 | printf( "%s: %s\n", $okey, $oval ? 'true' : 'false' ); 122 | } else { 123 | for( $i = 0; $i < $level * 3; $i++ ) { 124 | print " "; 125 | } 126 | printf( "%s: %s\n", $okey, $oval ); 127 | } 128 | } 129 | } 130 | 131 | function response_dump($name,$response) { 132 | print "================================================================================\n"; 133 | print "$name\n"; 134 | print "--------------------------------------------------------------------------------\n"; 135 | $this->obj_dump( $response, 1 ); 136 | print "================================================================================\n"; 137 | } 138 | 139 | } 140 | -------------------------------------------------------------------------------- /inc/ONVIFDevicemgmt.inc.php: -------------------------------------------------------------------------------- 1 | 9 | * include( 'inc/ONVIFDevicemgmt.inc.php' ); 10 | * ini_set( 'default_socket_timeout', 1800 ); 11 | * $wsdl = 'http://localhost/WSDL/devicemgmt-mod.wsdl'; 12 | * $service = 'http://192.168.0.1:888/onvif/device_service'; 13 | * $username = 'username'; 14 | * $password = 'password'; 15 | * $client = new ONVIFDevicemgmt( $wsdl, $service, $username, $password); 16 | * try { 17 | * $res = $client->get_network_interfaces(); 18 | * var_dump( $res ); 19 | * } catch ( Exception $e ) { 20 | * print "SOAP error occured\n"; 21 | * $res = $client->client->__getLastRequest(); 22 | * print "Last request:\n"; 23 | * print( $res . "\n" ); 24 | * $res = $client->client->__getLastResponse(); 25 | * print "Last response:\n"; 26 | * print( $res . "\n"); 27 | * } 28 | * 29 | * 30 | * @author Nickola Trupcheff 31 | * @version 0.1 32 | */ 33 | require_once('ONVIF.inc.php'); 34 | class ONVIFDevicemgmt extends ONVIF { 35 | public function set_hostname( $hostname ) { 36 | return $this->client->SetHostname(array( 37 | 'Name' => $hostname 38 | )); 39 | } 40 | 41 | public function get_hostname() { 42 | $res = $this->client->GetHostname(); 43 | return $res->HostnameInformation->Name; 44 | } 45 | 46 | public function get_capabilities() { 47 | return $this->client->GetCapabilities(); 48 | } 49 | 50 | public function get_wsdl_url() { 51 | $res = $this->client->GetWsdlUrl(); 52 | return $res->WsdlUrl; 53 | } 54 | 55 | public function get_device_information() { 56 | return $this->client->GetDeviceInformation(); 57 | } 58 | 59 | public function get_endpoint_reference() { 60 | return $this->client->GetEndpointReference(); 61 | } 62 | 63 | public function get_services() { 64 | return $this->client->GetServices(); 65 | } 66 | 67 | public function get_service_capabilities() { 68 | return $this->client->GetServiceCapabilities(); 69 | } 70 | 71 | public function get_remote_user() { 72 | return $this->client->GetRemoteUser(); 73 | } 74 | 75 | 76 | /** 77 | * Set camera date and time 78 | * @param bool $use_ntp 79 | * @param bool $daylight_savings 80 | * @param string $time_zone The TZ format is specified by POSIX, please refer to POSIX 1003.1 section 8.3 example: 81 | * example: CET-1CEST,M3.5.0/2,M10.5.0/3 82 | * @param int $utc_date_time in UTC 83 | * 84 | * set_system_date_and_time( false, false, 'CET-1CEST,M3.5.0/2,M10.5.0/3', time() ); 85 | * 86 | */ 87 | public function set_system_date_and_time($use_ntp, $daylight_savings, $time_zone, $utc_date_time) { 88 | $req = array( 89 | 'DateTimeType' => $use_ntp ? 'NTP' : 'Manual', 90 | 'DaylightSavings' => $daylight_savings, 91 | 'TimeZone' => array( 92 | 'TZ' => $time_zone, 93 | ), 94 | 'UTCDateTime' => array( 95 | 'Time' => array( 96 | 'Hour' => gmdate( 'H', $utc_date_time ), 97 | 'Minute' => gmdate( 'i', $utc_date_time ), 98 | 'Second' => gmdate( 's', $utc_date_time ), 99 | ), 100 | 'Date' => array( 101 | 'Year' => gmdate( 'Y', $utc_date_time ), 102 | 'Month' => gmdate( 'm', $utc_date_time ), 103 | 'Day' => gmdate( 'd', $utc_date_time ), 104 | ), 105 | ), 106 | ); 107 | $this->client->SetSystemDateAndTime( $req ); 108 | } 109 | 110 | public function get_system_date_and_time() { 111 | return $this->client->GetSystemDateAndTime(); 112 | } 113 | 114 | public function set_system_factory_default( $hard = true ) { 115 | $this->client->SetSystemFactoryDefault( array( 116 | 'FactoryDefault' => $hard ? 'Hard' : 'Soft', 117 | )); 118 | } 119 | 120 | public function system_reboot() { 121 | $this->client->SystemReboot(); 122 | } 123 | 124 | public function get_system_backup() { 125 | return $this->client->GetSystemBackup(); 126 | } 127 | 128 | public function get_system_support_information() { 129 | return $this->client->GetSystemSupportInformation(); 130 | } 131 | 132 | public function get_system_log() { 133 | return $this->client->GetSystemLog(); 134 | } 135 | 136 | public function get_scopes() { 137 | return $this->client->GetScopes(); 138 | } 139 | 140 | /** 141 | * Sets the scope parameters of a device 142 | * @param array $scopes list of configurable scopes 143 | */ 144 | public function set_scopes($scopes) { 145 | $this->client->SetScopes( 146 | $scopes 147 | ); 148 | } 149 | 150 | /** 151 | * Adds new configurable scope parameters to a device 152 | * @param array $scopes list of configurable scopes 153 | */ 154 | public function add_scopes($scopes) { 155 | $this->client->AddScopes( 156 | $scopes 157 | ); 158 | } 159 | 160 | /** 161 | * Remove configurable scope parameters from a device 162 | * @param array $scopes list of configurable scopes 163 | */ 164 | public function remove_scopes($scopes) { 165 | $this->client->RemoveScopes( 166 | $scopes 167 | ); 168 | } 169 | 170 | public function get_discovery_mode() { 171 | $res = $this->client->GetDiscoveryMode(); 172 | return $res->DiscoveryMode; 173 | } 174 | 175 | /** 176 | * Sets the discovery mode operation of a device 177 | * @param string $mode Discoverable|NonDiscoverable 178 | */ 179 | public function set_discovery_mode($mode) { 180 | $this->client->SetDiscoveryMode(array( 181 | 'DiscoveryMode' => $mode 182 | )); 183 | } 184 | 185 | public function get_remote_discovery_mode() { 186 | $res = $this->client->GetRemoteDiscoveryMode(); 187 | return $res->RemoteDiscoveryMode; 188 | } 189 | 190 | /** 191 | * Sets the remote discovery mode operation of a device 192 | * @param string $mode Discoverable|NonDiscoverable 193 | */ 194 | public function set_remote_discovery_mode($mode) { 195 | $this->client->SetRemoteDiscoveryMode(array( 196 | 'RemoteDiscoveryMode' => $mode 197 | )); 198 | } 199 | 200 | public function get_dp_address() { 201 | return $this->client->GetDPAddresses(); 202 | } 203 | 204 | public function get_users() { 205 | return $this->client->GetUsers(); 206 | } 207 | 208 | /** 209 | * 210 | * create_users( array( 211 | * array( 212 | * 'Username' => 'user1', 213 | * 'Password' => 'pass1', 214 | * 'UserLevel' => 'Operator', 215 | * ), 216 | * array( 217 | * 'Username' => 'user2', 218 | * 'Password' => 'pass2', 219 | * 'UserLevel' => 'Operator', 220 | * ), 221 | * )); 222 | * 223 | */ 224 | public function create_users($users) { 225 | $this->client->CreateUsers( 226 | array('User' => $users ) 227 | ); 228 | } 229 | 230 | /** 231 | * create user 232 | * @param string $username 233 | * @param string $password 234 | * @param string $level Administrator|Operator|User|Anonymous|Extended 235 | */ 236 | public function create_user( $username, $password, $level ) { 237 | $this->create_users( array( 238 | array( 239 | 'Username' => $username, 240 | 'Password' => $password, 241 | 'UserLevel' => $level, 242 | ) 243 | )); 244 | } 245 | 246 | /** 247 | * delete users 248 | * @param array $users array of usernames 249 | */ 250 | public function delete_users($users) { 251 | $this->client->DeleteUsers( 252 | array('Username' => $users ) 253 | ); 254 | } 255 | 256 | public function delete_user($user) { 257 | $this->delete_users( array( $user ) ); 258 | } 259 | 260 | /** 261 | * accepts same param as create_users 262 | */ 263 | public function set_user( $users ) { 264 | $this->client->SetUser(array( 265 | 'User' => $users 266 | )); 267 | } 268 | 269 | /** 270 | * @param bool $active True if the hostname shall be obtained via DHCP. 271 | * @return mixed RebootNeeded - Indicates whether or not a reboot is required after configuration updates. 272 | */ 273 | public function set_hostname_from_dhcp( $active ) { 274 | return $this->client->SetHostnameFromDHCP(array( 275 | 'FromDHCP' => $active 276 | )); 277 | } 278 | 279 | public function get_dns() { 280 | return $this->client->GetDNS(); 281 | } 282 | 283 | /** 284 | * Sets the DNS settings on a device 285 | * @param bool $from_dhcp Indicate if the DNS address is to be retrieved using DHCP. 286 | * @param array $search_domain DNS search domain 287 | * @param mixed array of IPAddress structures 288 | * 289 | * set_dns( 290 | * false, 291 | * array( 'example.com', 'second.example.com' ), 292 | * array( 293 | * array( 294 | * 'Type' => 'IPv4', 295 | * 'IPv4Address' => '192.168.0.2' 296 | * ), 297 | * array( 298 | * 'Type' => 'IPv4', 299 | * 'IPv4Address' => '192.168.0.20', 300 | * ) 301 | * ) 302 | * ); 303 | * 304 | */ 305 | public function set_dns($from_dhcp, $search_domain, $dns_manual) { 306 | $this->client->SetDNS(array( 307 | 'FromDHCP' => $from_dhcp, 308 | 'SearchDomain' => $search_domain, 309 | 'DNSManual' => $dns_manual 310 | )); 311 | } 312 | 313 | public function get_ntp() { 314 | return $this->client->GetNTP(); 315 | } 316 | 317 | /** 318 | * 319 | * set_ntp( 320 | * false, 321 | * array( 322 | * 'Type' => 'DNS', 323 | * 'DNSName' => '0.europe.pool.ntp.org', 324 | * ) 325 | * ); 326 | * 327 | */ 328 | public function set_ntp($from_dhcp, $ntp_manual) { 329 | $this->client->SetNTP(array( 330 | 'FromDHCP' => $from_dhcp, 331 | 'NTPManual' => $ntp_manual 332 | )); 333 | } 334 | 335 | public function get_dynamic_dns() { 336 | return $this->client->GetDynamicDNS(); 337 | } 338 | 339 | /** 340 | * @param string $type NoUpdate|ClientUpdates|ServerUpdates 341 | * 342 | * set_dynamic_dns( 'ClientUpdates', 'ns1.example.com', 1800 ); 343 | * 344 | */ 345 | public function set_dynamic_dns() { 346 | $this->client->SetDynamicDNS(array( 347 | 'Type' => $type, 348 | 'Name' => $name, 349 | 'TTL' => $ttl 350 | )); 351 | } 352 | 353 | public function get_network_interfaces() { 354 | return $this->client->GetNetworkInterfaces(); 355 | } 356 | 357 | public function get_network_protocols() { 358 | return $this->client->GetNetworkProtocols(); 359 | } 360 | 361 | /** 362 | * @param string $protocol HTTP|HTTPS|RTSP 363 | * @param bool $enable 364 | * @param int $port 365 | * 366 | * todo - implement edit of multple protocols 367 | */ 368 | public function set_network_protocol( $protocol, $enable, $port ) { 369 | $this->client->SetNetworkProtocols(array( 370 | 'NetworkProtocols' => array( 371 | 'Name' => $protocol, 372 | 'Enabled' => $enable, 373 | 'Port' => $port 374 | ), 375 | )); 376 | } 377 | 378 | public function get_network_default_gateway() { 379 | return $this->client->GetNetworkDefaultGateway(); 380 | } 381 | 382 | /** 383 | * @param string $address IPv4 Address X.X.X.X 384 | */ 385 | public function set_network_default_gateway_ipv4($address) { 386 | $this->client->SetNetworkDefaultGateway( array( 387 | 'IPv4Address' => $address 388 | )); 389 | } 390 | 391 | public function set_network_default_gateway_ipv6($address) { 392 | $this->client->SetNetworkDefaultGateway( array( 393 | 'IPv6Address' => $address 394 | )); 395 | } 396 | 397 | public function get_zero_configuration() { 398 | return $this->client->GetZeroConfiguration(); 399 | } 400 | 401 | /** 402 | * @param string $interface Unique identifier referencing the physical interface. 403 | * @param bool $enabled Specifies if the zero-configuration should be enabled or not. 404 | */ 405 | public function set_zero_configuration($interface,$enabled) { 406 | $this->client->SetZeroConfiguration( array( 407 | 'InterfaceToken' => $interface, 408 | 'Enabled' => $enabled 409 | )); 410 | } 411 | 412 | /** 413 | * Gets the IP address filter settings from a device 414 | */ 415 | public function get_ip_address_filter() { 416 | return $this->client->GetIPAddressFilter(); 417 | } 418 | 419 | public function get_access_policy() { 420 | return $this->client->GetAccessPolicy(); 421 | } 422 | 423 | /** 424 | * This operation gets all device server certificates (including self-signed) for the purpose of TLS 425 | * authentication and all device client certificates for the purpose of IEEE 802.1X authentication. 426 | */ 427 | public function get_certificates() { 428 | return $this->client->GetCertificates(); 429 | } 430 | 431 | /** 432 | * Manage auxiliary commands supported by a device, such as controlling an Infrared (IR) lamp, 433 | * a heater or a wiper or a thermometer that is connected to the device. 434 | * @param string $command tt:Wiper|On t:Wiper|Off tt:IRLamp|On tt:IRLamp|Off tt:IRLamp|Auto 435 | */ 436 | public function send_auxiliary_command($command) { 437 | $this->client->SendAuxiliaryCommand(array( 438 | 'AuxiliaryCommand' => $command 439 | )); 440 | } 441 | 442 | public function get_dot_11_configuration() { 443 | return $this->client->GetDot1XConfiguration(); 444 | } 445 | 446 | public function get_system_uris() { 447 | return $this->client->GetSystemUris(); 448 | } 449 | 450 | public function get_storage_configurations() { 451 | return $this->client->GetStorageConfigurations(); 452 | } 453 | 454 | } 455 | -------------------------------------------------------------------------------- /inc/ONVIFMedia.inc.php: -------------------------------------------------------------------------------- 1 | 10 | * include( 'inc/ONVIFMedia.inc.php' ); 11 | * ini_set( 'default_socket_timeout', 1800 ); 12 | * $wsdl = 'http://localhost/WSDL/media-mod.wsdl'; 13 | * $service = 'http://192.168.0.1:888/onvif/device_service'; 14 | * $username = 'username'; 15 | * $password = 'password'; 16 | * $client = new ONVIFMedia( $wsdl, $service, $username, $password); 17 | * try { 18 | * $res = $client->get_profiles(); 19 | * var_dump( $res ); 20 | * } catch ( Exception $e ) { 21 | * print "SOAP error occured\n"; 22 | * $res = $client->client->__getLastRequest(); 23 | * print "Last request:\n"; 24 | * print( $res . "\n" ); 25 | * $res = $client->client->__getLastResponse(); 26 | * print "Last response:\n"; 27 | * print( $res . "\n"); 28 | * } 29 | * 30 | * 31 | * @author Nickola Trupcheff 32 | * @version 0.1 33 | */ 34 | require_once('ONVIF.inc.php'); 35 | class ONVIFMedia extends ONVIF { 36 | /** 37 | * Returns the capabilities of the media service. 38 | */ 39 | public function get_service_capabilities() { 40 | return $this->client->GetServiceCapabilities(); 41 | } 42 | 43 | /** 44 | * This command lists all available physical video inputs of the device. 45 | */ 46 | public function get_video_sources() { 47 | return $this->client->GetVideoSources(); 48 | } 49 | 50 | /** 51 | * This command lists all available physical audio inputs of the device. 52 | */ 53 | public function get_audio_sources() { 54 | return $this->client->GetAudioSources(); 55 | } 56 | 57 | /** 58 | * This command lists all available physical audio outputs of the device. 59 | */ 60 | public function get_audio_outputs() { 61 | return $this->client->GetAudioOutputs(); 62 | } 63 | 64 | public function create_profile() { 65 | throw new Exception("Not implemented"); 66 | } 67 | 68 | public function get_profile() { 69 | throw new Exception("Not implemented"); 70 | } 71 | 72 | /** 73 | * List all configured profiles in a device. 74 | */ 75 | public function get_profiles() { 76 | return $this->client->GetProfiles(); 77 | } 78 | 79 | /** 80 | * Request a URI that can be used to initiate a live media stream using RTSP as the control protocol. 81 | * 82 | * @param string $stream_type RTP-Unicast|RTP-Multicast 83 | * @param string $protocol UDP|RTSP|HTTP 84 | * @param string $profile The ProfileToken element indicates the media profile to use and will define the configuration 85 | * of the content of the stream. Can be found with get_profiles, look under Profiles/0/token 86 | */ 87 | public function get_stream_uri($stream_type, $protocol, $profile = null) { 88 | return $this->client->GetStreamUri(array( 89 | 'StreamSetup' => array( 90 | 'Stream' => $stream_type, 91 | 'Transport' => array( 92 | 'Protocol' => $protocol, 93 | ), 94 | ), 95 | 'ProfileToken' => $profile 96 | )); 97 | } 98 | 99 | /** 100 | * List all video analytics configurations of a device. 101 | */ 102 | public function get_video_analytics_configurations() { 103 | return $this->client->GetVideoAnalyticsConfigurations(); 104 | } 105 | 106 | /** 107 | * List all existing metadata configurations. 108 | */ 109 | public function get_metadata_configurations() { 110 | return $this->client->GetMetadataConfigurations(); 111 | } 112 | 113 | public function get_snapshot_uri($media_profile) { 114 | return $this->client->GetSnapshotUri(array( 115 | 'ProfileToken' => $media_profile 116 | )); 117 | } 118 | 119 | public function get_osds() { 120 | return $this->client->GetOSDs(); 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /inc/ONVIFPTZ.inc.php: -------------------------------------------------------------------------------- 1 | 10 | * include( 'inc/ONVIFPTZ.inc.php' ); 11 | * ini_set( 'default_socket_timeout', 1800 ); 12 | * $wsdl = 'http://localhost/WSDL/ptz-mod.wsdl'; 13 | * $service = 'http://192.168.0.1:888/onvif/device_service'; 14 | * $username = 'username'; 15 | * $password = 'password'; 16 | * $client = new ONVIFPTZ( $wsdl, $service, $username, $password); 17 | * try { 18 | * $res = $client->get_service_capabilities(); 19 | * var_dump( $res ); 20 | * } catch ( Exception $e ) { 21 | * print "SOAP error occured\n"; 22 | * $res = $client->client->__getLastRequest(); 23 | * print "Last request:\n"; 24 | * print( $res . "\n" ); 25 | * $res = $client->client->__getLastResponse(); 26 | * print "Last response:\n"; 27 | * print( $res . "\n"); 28 | * } 29 | * 30 | * 31 | * @author Nickola Trupcheff 32 | * @version 0.1 33 | */ 34 | require_once( 'ONVIF.inc.php'); 35 | class ONVIFPTZ extends ONVIF { 36 | /** 37 | * Returns the capabilities of the PTZ service. 38 | */ 39 | public function get_service_capabilities() { 40 | return $this->client->GetServiceCapabilities(); 41 | } 42 | 43 | /** 44 | * Get the descriptions of the available PTZ Nodes. 45 | */ 46 | public function get_nodes() { 47 | return $this->client->GetNodes(); 48 | } 49 | 50 | /** 51 | * Get a specific PTZ Node identified by a reference token or a name. 52 | * 53 | * @param string $node reference token or a name 54 | */ 55 | public function get_node($node) { 56 | return $this->client->GetNode(array( 57 | 'NodeToken' => $node, 58 | )); 59 | } 60 | 61 | /** 62 | * Get a specific PTZonfiguration from the device, identified by its reference token or name. 63 | * 64 | * @param string $token reference token or name 65 | */ 66 | public function get_configuration($token) { 67 | return $this->client->GetConfiguration(array( 68 | 'PTZConfigurationToken' => $token, 69 | )); 70 | } 71 | 72 | /** 73 | * Get all the existing PTZConfigurations from the device. 74 | */ 75 | public function get_configurations() { 76 | return $this->client->GetConfigurations(); 77 | } 78 | 79 | public function set_configuration() { 80 | throw new Exception( "Not implemeted" ); 81 | } 82 | 83 | /** 84 | * List supported coordinate systems including their range limitations. 85 | * 86 | * @param string $token Token of an existing configuration that the options are intended for. 87 | */ 88 | public function get_configuration_options($token) { 89 | return $this->client->GetConfigurationOptions(array( 90 | 'ConfigurationToken' => $token 91 | )); 92 | } 93 | 94 | public function send_auxiliary_command() { 95 | throw new Exception( "Not implemented" ); 96 | } 97 | 98 | /** 99 | * Operation to request all PTZ presets for the PTZNode in the selected profile. 100 | * 101 | * @param string $profile A reference to the MediaProfile where the operation should take place. 102 | */ 103 | public function get_presets($profile) { 104 | return $this->client->GetPresets(array( 105 | 'ProfileToken' => $profile 106 | )); 107 | } 108 | 109 | public function set_preset() { 110 | throw new Exception("Not implemented"); 111 | } 112 | 113 | public function remove_preset() { 114 | throw new Exception("Not implemented"); 115 | } 116 | 117 | public function goto_preset() { 118 | throw new Exception("Not implemented"); 119 | } 120 | 121 | 122 | } 123 | --------------------------------------------------------------------------------