code style

This commit is contained in:
john30
2017-01-14 13:00:04 +01:00
parent d13b271a05
commit b3bb2e08ac
49 changed files with 1853 additions and 1858 deletions
+8 -8
View File
@@ -16,14 +16,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "device.h"
#include <iostream>
#include <iomanip>
#include "device.h"
using namespace std;
int main ()
{
int main () {
Device* device = Device::create("/dev/ttyUSB20", true, false, false);
if (device == NULL) {
cout << "unable to create device" << endl;
@@ -33,26 +32,27 @@ int main ()
if (result != RESULT_OK) {
cout << "open failed: " << getResultCode(result) << endl;
} else {
if (!device->isValid())
if (!device->isValid()) {
cout << "device not available." << endl;
}
int count = 0;
while (1) {
unsigned char byte = 0;
result = device->recv(0, byte);
if (result == RESULT_OK)
if (result == RESULT_OK) {
cout << hex << setw(2) << setfill('0')
<< static_cast<unsigned>(byte) << endl;
}
count++;
}
device->close();
if (!device->isValid())
if (!device->isValid()) {
cout << "close successful." << endl;
}
}
delete device;