All pastes #2108525 Raw Edit

Something

public text v1 · immutable
#2108525 ·published 2012-02-01 08:17 UTC
rendered paste body
#include <SerialStream.h>
#include <string>
#include "ConfigPort.h"

class afficheurTraveComBny: public LibSerial::SerialStream {
public:
	afficheurTraveComBny(const char* nomPort):;
//	void afficher(std::string texte); // Affiche le Texte sur la Voie Série
	void configurer(const ConfigPort& config); // Configure la Voie Série
	virtual ~afficheurTraveComBny() throw ();
};




#include "afficheurTraveComBny.h"
#include <iostream>
#include <SerialStreamBuf.h>

void afficheurTraveComBny::afficher(std::string texte) :
		LibSerial::SerialStream(texte, std::ios::in | std::ios::out) {
}

void afficheurTraveComBny::configurer(const ConfigPort& config) {
	this->SetBaudRate(config.vitesse);
	this->SetCharSize(config.donnee);
	this->SetParity(config.parite);
	this->SetNumOfStopBits(config.bitStop);
	this->SetFlowControl(config.controle);
}
afficheurTraveComBny::~DialoguerComBny() throw () {
	if (this->IsOpen()) //réutilisation d'une class donc il y a la majuscule.
		this->Close();
}
#ifndef NDEBUG
//génération : g++ AfficheurEntreeComBny.cpp -D _UNIT_TEST_ -lserial
int main(int argc, char **argv) {
	ConfigPort LOCALE = {LibSerial::SerialStreamBuf::BAUD_9600,
		LibSerial::SerialStreamBuf::CHAR_SIZE_8, 1,
		LibSerial::SerialStreamBuf::PARITY_NONE,
		LibSerial::SerialStreamBuf::FLOW_CONTROL_NONE};
	DialoguerComBny* ps = new DialoguerComBny(argv[1]);
	ps->configurer(LOCALE);
	std::string m,b;
	b="bye";

		*ps << "" << std::endl;

}
#endif