Skip to content

dtrammer/AxisDeviceDiscoveryLib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AxisDeviceDiscoveryLib

C# Library to discover Axis devices on a TCP/IP network, it uses the Microsoft SOAP based WS-Discovery protocol and UPNP Protocol

Prerequisite & install

  • .net 4.5.2
  • Download the AxisDeviceDiscoveryLib.dll and add it as a reference to your VS project Use the object browser to explore the ActionEventLib namespace

Comments

  • The library supports and scans on multiple Network Interfaces at once
  • Searches are executed on different threads
  • WS-Discovery is a Microsoft standard protocol that allows the discovery of web-services over a TCP/IP network, all devices that support ONVIF will reply to this protocol, this is enabled by default on Axis devices (if it supports ONVIF). Devices from other vendors with support for ONVIF can also be detected
  • UPNP is also enabled by default on Axis devices, by setting the MACVendorFilterPrefix (by default : "00408C|ACCC8E" for Axis devices) property to an empty string on the Discovery_Upnp service object, one can discover all UPNP enabled devices on a TCP/IP network (for ex: Other vendor cameras, Smart TV's, Smart phones etc ...)

Usage samples

DiscoveryService discovery = new DiscoveryService(OnCompletedCallback);

discovery.Search(3000);

  1. Declare a DiscoveryService object and pass it a Callback method that will be invoked on completion.
    • Callback is of type eOnDiscoveryCompleted(IList<networkInterface> Interfaces)
  2. Then call the Search(int TimeoutInMillisec) method on the DiscoveryService reference

The callback will be invoked on completion that occurs after the specified timeout in the Search(...) method, it will be passed a List of <networkInterface> instances as parameter representing the active network interfaces of the system, each networkInterface instance has a property of type List<deviceNetworkInfo> that contains the discovered device information.

Callback example :

private void OnCompletedCallback(IList<networkInterface> Interfaces) {

 //Do something with the results in the different networkInterface instances

}

It's also possible to search with one specific protocol only, by using the Discovery_Upnp and Discovery_WS objects

DiscoveryService discovery = new DiscoveryService();

IDiscoveryService upnpSearch = new Discovery_Upnp(discovery.ActiveInterfaces,OnCompletedCallback)

upnpSearch.search(3000);

OR

IDiscoveryService WS_Search = new Discovery_WS(discovery.ActiveInterfaces,OnCompletedCallback)

WS_Search.search(3000);

// The protocol service objects are of type IDiscoveryService, that contains a OnCompleted event property, bool IsRunning property and a Search(int TimeOutMillisec) method

The networkInterface instance has members :

  • Lanid (in case you have multiple interfaces installed on the system)
  • IPAddress, the current IPv4 address used by the interface
  • type, representing the Data-link protocol either NetworkInterfaceType.Ethernet or NetworkInterfaceType.Wireless80211
  • DiscoveredDevices, a List of <deviceNetworkInfo> instances representing a discovered device on the network

The deviceNetworkInfo instance has members :

  • IPAddress, IPv4 address of the device
  • MACAddress
  • XAddress, onvif service address
  • Model, device model name

For more usage samples, have a look at the UnitTest project

About

C# Library to discover Axis devices on TCP/IP networks

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages