Reference source code is available to registered members on the downloads page. In order to view ANT source code, you will need to become an ANT+ Adopter which is free of charge. Please refer to the ANT Licensing section for more details.
The DeviceX.txt is created every time you start a communication session with ANT when using the ANT DLL. This file contains a log of the entire session, and is a very useful troubleshooting tool.
If you are developing an application using the ANT DLL, you can turn this off by building the ANT DLL without the DEBUG_FILE option.
Using the ANT Managed Library (ANT_NET) an ANT_Device object may be instantiated for each USB or serial deviceANT USB device present in the system. This is not possible with the ANT_DLL.
Most of the DLL functions return a Boolean indicating the result of the function call. This does not necessarily mean that the command was successful; you must wait for the response message from ANT for this.
When developing PC applications, the PC is acting as the host controller, so when a DLL function is called, the corresponding message is sent to ANT. ANT will reply to most messages with another message, indicating whether they ere successful or not. For example, when configuring the Channel ID, ANT will respond with a RESPONSE_NO_ERROR if the configuration was successful. This means that you have to process incoming messages from ANT to identify whether your command was successful or not. If the command was not successful, ANT will not issue any response. The application host controller must timeout appropriately if no response is received to a serial command. Please note that not all serial commands require a response. Please check the ANT Message Protocol and Usage document for details.
The ANT static library (ANT_LIB) and the ANT managed library (ANT_NET) include an optional response timeout parameter on most function calls, that implements the mechanism described above to determine whether the command was successful or not.
The ANT_NET.dll is a C# managed class library for use with version 3.5 or higher of the .NET framework; it is intended to be used together with the ANT_WrappedLib.dll. ANT_DLL.dll is a C++ library. Both may be compiled using Visual Studio 2008. The following table describes some of the main differences between the libraries:
Static Library (ANT LIB) |
Dynamic Library (ANT DLL) | Managed Library (ANT NET) | |
Languages | C++ | C, C++ | C#, C++/CLI, VB.NET |
OS | Windows, MacOS | Windows, MacOS | Windows |
API | Object oriented C++ interface | Flat C interface | Object oriented managed inferface |
Connect to multiple ANT Devices | Yes | No | Yes |
ANT-FS | Yes | No | Yes |
Yes, registered development kit owners and ANT+ Adopters can get the source code for the ANT on the ANT Developer’s Zone. Look for the ANT Library Package for Windows/MacOSX.
When developing a PC application interfacing to ANT, the basic sequence to configure an ANT channel is:
1. Set the network key.
ANT_SetNetworkKey(ANT_NETWORK, aucNetworkKey);
2. Assign the channel
ANT_AssignChannel(ANT_CHANNEL, ucChannelType, ANT_NETWORK);
3. Set the channel ID
ANT_SetChannelId(ANT_CHANNEL, usDeviceID, ucDeviceType, ucTxType);
4. Set the message period
ANT_SetChannelPeriod(ANT_CHANNEL, usMessagePeriod);
5. Set the RF frequency
ANT_SetChannelRFFreq(ANT_CHANNEL, ucRFFreq);
6. Open the channel
OpenChannel(ANT_CHANNEL);
The application must make sure that each command was successful before proceeding to the next step. You may also set the transmit power and slave timeout, however these are optional (as is RF frequency and message rate).
The example above refers to using the ANT_DLL. The sequence is the same when using other variants of the ANT libraries, but the syntax is slightly different. For more details, please refer to the demos accompanying the ANT Library Package.
The downloads page provides the full source code of the ANT Libraries, along with demo code demonstrating how to import the libraries, connect to an ANT USB stick, configure a channel (master/slave) and send data. The source code is available for C++ and C#, and can be built using Visual Studio 2008 (C++/C#) for Windows, and Xcode for Mac. These demos are the best starting point for working with ANT, as they are simple console based applications, with documentation within the code.
The ANT library project files are intended to be compiled with Visual Studio 2008 or Visual Studio Express 2008. If using Visual Studio Express, use the C++ version for ANT_Libraries.sln and the C# version for ANT_NET_Libraries.sln. Version 3.5 of the .NET framework is also required.
Due to the large effort and expertise required to maintain reference designs in a variety of programming languages and development environments, we do not provide a reference design for using the ANT DLL with Java. It is possible to call C/C++ functions exported from a DLL on Java, for example using J/Invoke; however, we are unable to provide support with this.
Yes, the ANT Library Package for MacOSX includes the libraries, along with console application demo code to get you started.
Yes. The ANT Library package for windows includes Bboth managed (ANT_NET.dll) and unmanaged libraries (ANT_DLL.dll and ANT_LIB static library), along with console application demos showing how to use all of these. Our most recent reference designs for PC applications use the .NET framework (Version 3.5 SP1) and can be compiled using the free version of Microsoft Visual Studio 2008. These are available in the ANT Developer’s Zone.
Due to the large effort and expertise required to maintain reference designs in a variety of programming languages and development environments, there is no official reference design for using the ANT DLL with LabView.