I try to use LibSerial’s class for serial communication (with an ATMega32A) through a COM port.
As soon as I include the SerialStream.h I get several error messages from the file SerialPort.h.
#include "SerialStream.h"
You can see the errors I get here.
http://i.stack.imgur.com/s8ZdC.png
Since I did not fully understand the installation of LibSerial, I think I use the class the wrong way.
I use the compiler QT Creator and the OS is Windows 7.
Feel free to ask for more information if you need it.
The question is not answerable in it's current format.
Nevertheless, if you are willing to use Qt's features to read from a serial port, I could point you to a demo I wrote a while ago.
Quick notes: main.cpp retrieves information and detects all serial ports on the computer and presents a menu to let the user choose which port to read from. Then it uses QSerialPort to open a connection to that specific port, and the reading part is done by SerialPortReader, a class implemented on that project.
Related
i have a board and a GPS,accelerometer,gyroscope onboard.
I'm connecting the board to the computer by using a TTL-232R-3V3 ,which is a USB to TTL Serial Cable (3.3V).
After installing the drivers, the assigned COM port is the number 3.
I'm able to read the output simply by using a serial monitor (i've tried with the one included in the Arduino IDE, just for try).
Now i need to create a C++ program which allows me to take the output of the board and store the datas in vectors.
Do i need any libraries? What's the best procedure to do it?
Thanks in advance!
In my company I used the boost library to read from a COM port. It includes the boost::asio::serial_port class to handle this kind of communication.
I used this code snippet for orientation and wrote my own wrapper class, for the needs of the project I was in.
You can take this:
http://www.codeproject.com/Articles/992/Serial-library-for-C
Or if you use Qt, i think there is also a lib from Qt to do this.
I am working on a C++-based MIDI sending app and it's the first time I'm working with MIDI.
I chose the RtMidi library because it seems to be the most complete library around, but I'm open to suggestions.
The OS that I'm working on is Windows 7 and I have an USB-MID interface installed and it's working with other programs (i.e. Roland UM-One).
Now I may be way off-track, but I'd expect that when you do a search for ports, it should show this device.
When compiling the example code for RtMidi i get no ports; in or out.
What am I missing?
Do i need to open a virtual port?
This is also for others experiencing a similar issue as well:-
When I first started using RtMIDI, if you don't specify (on OSX at least) a macro define for the target system, the example code by default uses a dummy MIDI device, and this will have no MIDI ports.
Once I had specified MAC_OSX_CORE, then RtMIDI used the correct architecture and returned the MIDI devices on my system as expected. Perhaps you have to do something similar for your system - check the docs under "Compiling":
http://www.music.mcgill.ca/~gary/rtmidi/index.html#compiling
I've worked briefly with RtMidi and it is, as you stated, a rather complete library. However, when working with MIDI devices, you have to take the specific issues of this type of devices into account.
Another thing is that cheap USB-MIDI adapters often simply refuse to work with some applications "just because". They are very simple inside, yet apparently chinese manufacturers are still able to make malfunctioning devices.
If you're using unmodified, example code, and it's not showing your device, I'll first ensure all other apps that might be using it are closed, then try again. Creating a virtual interface is also a nice idea; I personally use freeware LoopBe1 for it. If it will show the virtual, but not the real interface, then the problem is with device itself. In that case you might want to experiment with different drivers or simply plugging it into a different port.
If it doesn't show any device, neither real nor virtual, then I strongly suspect there's something wrong in the way you build/run the application.
I've been looking for hours for a way to write to a serial port. Every way that I have found I haven't been able to implement. The program I'm currently using for Recvfrom() functions requires me to disable precomplied headers (I'm not sure if thats an issue). So what I'm basically asking is, is there a way to transmit a variable through a serial port, and if so what is the easiest way to go about it.
Precompiled headers isn't really an issue - if you are including other code directly in your project rather than building a library you might have to add the #include stdaxf.h to that code, or you can simply include the .h and .cpp files directly into your code file.
If you want to talk to the serial port directly in win32 it's easy enough. The big issue is handling the threading and waiting for new data to arrive - but if you just want to send and sit there waiting for a response it's easy
You could use qextserialport a library for serial communication with QT.
Here is the link to the function recvfrom() in the msdn documentation. Also contains a sample. http://msdn.microsoft.com/en-us/library/windows/desktop/ms740120%28v=vs.85%29.aspx
I have compiled without any problems in VS2010.
Just make sure that the very first line in your cpp file is
#include "stdafx.h"
otherwise you would run into all sorts of compiler and link errors. Precompiled header is not an issue if you follow what I wrote previously.
Hope that helps.
I have inherited some rather old software which connects to a serial port, formats the incoming data and displays and saves it. The software is written in an old Borland compiler (C++ Builder 5.0), and uses CreateFile to open the port, followed by SetupComm for the comm parameters.
Someone has asked me to add new functionality: Enable taking a recorded session, and replaying it as though it was coming in on the serial port.
I'm looking at several possible solutions, the easiest and quickest involving a second serial port and a null modem cable. This isn't exactly what they had in mind, but it does solve the problem. However, assume I don't have this option. Is there any way to redirect a comm port to a file, so that when the "com port" was opened it would open the file and read from it? Or is there a simple parallel way to open the file (the same call to CreateFile, for example), and bypassing the call to SetupComm so that the input would come from file if desired?
Since I do have the simple HW solution, I don't want to invest hours rewriting the code, but if there is a simple way of going about it, I'd like to know.
I'll award somehow the reputation points to Eugen Rieck, the suggestion was his. The way I did this was with a package called com0com, which is an open source virtual com port. I wrote a routine which sends to one virtual com port, connected the com port of the original software to another one paired with that one, and the funcationality is there.
Im looking for code that connects to another computer via remote desktop connection and checks if the connection was successful or not.
I packet logged and found out there was a galaxy worth of packets so i was wondering if there was some easy code out there.
There really isn't anything easy about RDP, that protocol stack is huge and builds on the ITU OSI protocols, which includes a fair amount of ASN.1/BER.
Your best bet is the code that's in FreeRDP.
A bit of terminology: you want a "RDP client library for C++".
As others have mentioned, look into the "FreeRDP" and "rdesktop" projects.
With FreeRDP, you're going to get a suite of libraries (each one doing it's thing). With rdesktop, you're going to get a client app (which you have to break the C code out of, and "build" your C++ api around).
If this is a new project, I'd pick FreeRDP over rdesktop, as they have libraries available with your C++ interface already in place.
Do you need to check if an RDP server is present, but not authenticate? In this case all you'd need are the first couple of packets used to negotiate protocol security. You can find the code in FreeRDP in libfreerdp-core/nego.c.
#Blanker1231 : You should have look on rdesktop code , its in c but can be very easily modified to be used in a C++ code , all you have to do is bridge their Struct Stream effectively .
moreover I have worked on a Rdp 7+ implementation ages ago in qt/c++ for a , so recently just for fun of it i used all of my experience and wrote a RDP parser and code generator and open sourced it on https://github.com/shashanksingh/Code-Generator-for-RDP
Right now it dead simple and i am still working on it more intelligent . Word of caution it doesn't generate everything . Examples includes demo.def which on compilation will generate all the class os ms-fscc used in ms-rdp
#Blanker1231 if you ever feel like , just fork the implementation and start pushing stuff in