Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

   

multiple ANT Device instances in single application

Rank

Total Posts: 12

Joined 2013-07-09

PM

Dear All,
How can I develop an application in which I can create instances of more than one ANT_Device. When I try to create the second instance of ANT_Device using ANT_Managed_Library, it generates the following error.

----------------------------------error log------------------------------
HEAP[Hmor.exe]: Invalid address specified to RtlValidateHeap( 012C0000, 0FC343D4 )
'Hmor.exe' (Win32): Loaded 'C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Core\483443985708dc5439abe7fd6350abe4\System.Core.ni.dll'.
'Hmor.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
HEAP[Hmor.exe]: Invalid address specified to RtlValidateHeap( 012C0000, 0FC343D4 )
Hmor.exe has triggered a breakpoint.
--------------------------------------

It seams to me that ANT_Managed_library do't allow multi threads for the ANT_Devices.

Kindly can you suggest me how I can do this.      
Avatar
RankRankRankRank

Total Posts: 662

Joined 2012-10-09

PM

It is possible to create multiple ANT_Device instances in a single application - ANTware II relies on this functionality to provide support for multiple USB sticks. All instances are created from the main UI thread, if that helps.

Can you provide more details on your setup (Windows version, 32/64 bit, what language are you using, etc)? What version of the libraries are you using?      
Rank

Total Posts: 12

Joined 2013-07-09

PM

Following is my setup:
Windows 8.1 64 bit C sharp and
VS 2013 with target framework 4.0
I have changed the target platform to x86 and have replaced all the DLLs now I am not receiving the above error. Also I have changed some of the code especially the device instance. I was disposing it somewhere else which I think was effecting. Thank you for your advice.

Now, I want to take your advice, If I do't know the number of possible attached USB's in advance (as you said in the case of ANTWare II) then what collection data structure would be best to handle the USB's. I am planning to use the following but do't know the trade offs:

Dictionary<int, ANT_Device> antDeviceDic = new Dictionary<int, ANT_Device>();

I think I can add and remove the created devices in above dictionary object but latter I have to manage the Channels and networks. Would it be good to manage USBs like this.