Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

how to create CNiFieldPointNetwork module in Multithreaded apartment

same as above.. thank for any demo or application code..
0 Kudos
Message 1 of 13
(7,523 Views)

Hi thatsalok,

What version of Measurement Studio and Visual Studio are you using?  The reason I ask is that is that the Measurement Studio FieldPoint API is now obsolete. Check out the
FieldPoint Measurement Studio 7.0 Visual C++ API Has Been Obsoleted and Can I Use Microsoft Visual C++ 6.0 and/or Visual C++ .NET with My FieldPoint Modules? KnowledgeBases. These documents discuss some general points of using FieldPoint with Visual C++.

Another method of communicating with FieldPoint devices is through DataSocket API.  Check out the
Introduction to Using DataSocket Commands to Communicate with FieldPoint Ethernet Network Modules and Using Advanced DataSocket Commands with FieldPoint Ethernet Network Modules tutorials. 

The Developing an OPC Client Application Using Visual Basic tutorial also is a good reference (even though its Visual Basic).

If you are using Visual C++ 6.0 check out the
<MeasurementStudio>\VC\Examples\DataSocket directory for examples.
If you are using Visual C++ check out the
<MeasurementStudioVS(2003 or 2005)>\DotNET\Examples\DataSocket\ directory for examples.

Hope this helps!

Best Regards,

Jonathan N.
National Instruments
0 Kudos
Message 2 of 13
(7,516 Views)
Thanks for reply sir.. but i am not able to connect to the FieldPoint through the datasocket...
My Field point is a this  ip address - 157.247.157.78
 i am trying to connect FP-1601 @0 module  with following url....
lookout://157.247.157.78/FP-1601 @0
is it correct or i have to change something

thanks
0 Kudos
Message 3 of 13
(7,504 Views)
thanks sir ...  i am able to connect to remote module using this->

 lookout://157.247.157.78/FP/1AI/01

 but it service only one channel.. is there any method to subscrib to every channel of  that module...
0 Kudos
Message 4 of 13
(7,503 Views)
hi Sir,
   i am not able to access data of channel associated with DataSocket from other thread even i open it with CNiInterface::Multithread!

any pointer and suggestion will be of great help!

0 Kudos
Message 5 of 13
(7,490 Views)

Hi thatsalok,

To answer you question about what string to use to access all the lines on your analog input module, I would try "lookout://157.247.157.78/FP/1AI/ALL"  .  That should make your data come into your program as an array.  Hope that helps.

Brian K.
0 Kudos
Message 6 of 13
(7,479 Views)
HI All,
   thanks for so much help.. actually i am one more trouble i am not able to access the data between the thread. i.e.
this
 
 
g_pToMainClass ;// Global Pointer To Main Window Classs
 
CollectData()
{
// Collect Data by using DataSocket
}
 
 
DWORD ThreadProc(LPVOID lpVoid)
{
    g_pToMainClass()->CollectData();  // not working exception
   g_pToMainClass()->PostMessage(UWM_COLLECTDATA,0,0);/// Working. .. if we map UWM_COLLECTDATA with CollectData function
}
 
 I need to get first method work! as our Software architecture required first method.. as second method will not suit our need.. could anybody give me some pointer to get it work..thanks!
 
0 Kudos
Message 7 of 13
(7,453 Views)
HI Brian,
   Thanks for reply... i tried marshalling using CComGITPtr or RegisterInterfaceInGlobal.. but it required the base interface of CNiDataSocket class.. could you give method to reterive the base interface of the CNiDataSocket
0 Kudos
Message 8 of 13
(7,451 Views)
Hi thatsalok,

You may not need to use the Global Interface Table if you try and use the CNiComInitialize Measurement Studio function. I would use the Multithreaded concurrency model option and see if this helps. Check out the Measurement Studio help for details.  If this doesn't help, let me know and then we can look at going the GIT route.

Best Regards,
Jonathan N.
National Instruments
0 Kudos
Message 9 of 13
(7,435 Views)
hi Jonathan,
  Thanks for reply,i tried what you say. but my other component start crashing after using it ( as they using apartment model).. so i believe GIT route would be better solution now.. 
waiting for your reply

Regards
Alok
0 Kudos
Message 10 of 13
(7,405 Views)