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.
Related
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.
I'm writing a C++ server for an autonomous vehicle. The vehicle has a camera on it and many image processing algorithms to help it understand its surrounding.
The server needs to be able to receive an image processing algorithm(a cpp file and a header file) from a client ,and to run this algorithm.
My question is, how can a program include a header file while running(is it even possible)?
No, you cannot include a header file while a program is running. You are describing a plug-in architecture. C++ provides no native support.
If you really want to do this, you have a lot of work in front of you. You have to devise (or find) a suitable plug-in architecture that allows on-the-fly loading. You have to implement the algorithms you need in that architecture. You have to devise a mechanism to identify required algorithms and load them.
Surely it would be better to start with a static architecture and pre-load every algorithm you can think of before going down this route?
Here are my 2 cents..
1) Have a tiny c/c++ compiler in hand [http://en.wikipedia.org/wiki/Tiny_C_Compiler].
2) Once you recieve the source file, invoke the compiler progmatically and build the objects.
3) Then load those object dynamically.
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
I want to write a program to create VOIP application for my final year project. For this time being, I spend my time to understand how SIP works and later I need to implement it into my project. As far as i know, the protocol requirement to build this project are:
UDP
RTP
As for my project, it doesn't requires me to write a complex coding. I just need to provide a server that can be used as a bridge for clients to communicate. So, is there any resources that I can used for my reference to start programming my project?
Maybe these will be helpful to look at:
Open source RTP library:
jrtplib:
Open source RTSP, RTP with a SIP client AFAIR:
liveMedia
Open source SIP library: reSIProcate
Your best bet is pjsip.
http://www.pjsip.org/
It runs on all kinds of OSes
OpenSipStack is quite nice, it's 100% C++.
The project also contains a library for creating clients using ATL.
Take a look at OPAL. It allows you to write applications that will support SIP, H.323 and IAX2.
Specifically I am talking about using AIM and sending instant messages to an existing AIM screename. How would I accomplish this? I am trying to do it the simplest way possible -efficiency is not that important.
I thought maybe all I would have to do is open a socket connections some how but I am probably wrong.
I would use libpurple. It's a multi-platform C library that supports many IM services, including AIM.
Check out the source for GAIM/Pidgin, which runs on a variety of platforms including windows. It uses a modified version of libfaim.