1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
|
/*
Copyright (C) 2014 BARRATERO Laurent
AeroUp is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
Aeroup is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/*
* Filename: ultimatecmd.cpp
*
* Description: Interface for Ultimate props
*
* Version: 0.3.0
* Created: 19/12/2013 20:28:22
* Revision: none
* Compiler: gcc
*
* Author: BARATTERO Laurent, laurentba<at>larueluberlu.net
* Organization: La rue Luberlu
*/
#include <stdlib.h>
#include "ultimate.hpp"
extern bool VERBOSE_AERO;
using namespace std;
Ultimate::Ultimate ( string serial_name ):
ser(serial_name)
{
} /* ----- end of constructor ----- */
/*
* Class: Ultimate
* Method: Ultimate :: test
* Description:
*/
void Ultimate::test ()
{
ser.test();
}
/*
* Class: Ultimate
* Method: Ultimate :: start
* Description:
*/
void
Ultimate::start ()
{
ser.start();
}
/*
* Class: Ultimate
* Method: Ultimate :: color
* Description:
*/
void
Ultimate::color (unsigned char red, unsigned char green, unsigned char blue)
{
ser.color(red, green, blue);
}
/*
* Class: Ultimate
* Method: Ultimate :: getSerial
* Description:
*/
string
Ultimate::getSerial ()
{
string nb = ser.getSerial();
return nb;
}
/*
* Class: Ultimate
* Method: Ultimate :: uploadGloc
* Description:
*/
int
Ultimate::uploadGloc ( string filename)
{
return sizeof(filename);
}
/*
* Class: Ultimate
* Method: Ultimate :: uploadGlo
* Description:
*/
int
Ultimate::uploadGlo ( string fileName)
{
GloSeq file(fileName);
file.verify();
// to do add security
file.upload(ser);
return sizeof(fileName);
}
/*
* Class: Ultimate
* Method: Ultimate :: setSerialUlt
* Description:
*/
uint32_t
Ultimate::setSerialUlt(uint32_t serialNumber)
{
uint8_t ser_nb[6] = {83,0,0,0,0,0};
ser_nb[4] = (uint8_t)((serialNumber & 0xff000000UL) >> 24);
ser_nb[3] = (uint8_t)((serialNumber & 0x00ff0000UL) >> 16);
ser_nb[2] = (uint8_t)((serialNumber & 0x0000ff00UL) >> 8);
ser_nb[1] = (uint8_t)((serialNumber & 0x000000ffUL) );
ser.serialNumber(ser_nb) ;
return serialNumber;
//exit (EXIT_FAILURE);
}
|