50
50
* @author marcel.mikolajko
51
51
*/
52
52
public class PlatformCommands {
53
+
53
54
static Logger LOGGER = Logger .getLogger (PlatformCommands .class .getName ());
54
55
55
56
@ Command (name = "gps" , subcommands = {GetNMEASentence .class })
@@ -66,6 +67,7 @@ public static class Camera {
66
67
67
68
@ Command (name = "take-picture" , description = "Take a picture from the camera" )
68
69
public static class TakePicture extends BaseCommand implements Runnable {
70
+
69
71
@ Option (names = {"-res" , "--resolution" }, paramLabel = "<resolution>" , required = true ,
70
72
description = "Resolution of the image in format widthxheigh. For example 1920x1080" )
71
73
String resolution ;
@@ -109,17 +111,20 @@ public void run() {
109
111
}
110
112
111
113
String [] res = resolution .split ("x" );
112
- CameraSettings settings = new CameraSettings (new PixelResolution (new UInteger (Integer .parseInt (res [0 ])),
113
- new UInteger (Integer .parseInt (res [1 ]))), PictureFormat .fromString (format .toUpperCase ()), new Duration (
114
- Double .parseDouble (exposure )), Float .parseFloat (gainRed ), Float .parseFloat (gainGreen ), Float
115
- .parseFloat (gainBlue ));
114
+ CameraSettings settings = new CameraSettings (
115
+ new PixelResolution (new UInteger (Integer .parseInt (res [0 ])), new UInteger (Integer .parseInt (res [1 ]))),
116
+ PictureFormat .fromString (format .toUpperCase ()),
117
+ new Duration (Double .parseDouble (exposure )),
118
+ Float .parseFloat (gainRed ), Float .parseFloat (gainGreen ), Float .parseFloat (gainBlue ),
119
+ null
120
+ );
116
121
117
122
final Object lock = new Object ();
118
123
try {
119
124
camera .takePicture (settings , new CameraAdapter () {
120
125
@ Override
121
126
public void takePictureResponseReceived (MALMessageHeader msgHeader , Picture picture ,
122
- Map qosProperties ) {
127
+ Map qosProperties ) {
123
128
System .out .println ("Picture received: " + picture );
124
129
try {
125
130
filename = filename + "." + format .toLowerCase ();
@@ -136,7 +141,7 @@ public void takePictureResponseReceived(MALMessageHeader msgHeader, Picture pict
136
141
137
142
@ Override
138
143
public void takePictureResponseErrorReceived (MALMessageHeader msgHeader , MALStandardError error ,
139
- Map qosProperties ) {
144
+ Map qosProperties ) {
140
145
LOGGER .log (Level .SEVERE , "Error during takePicture!" , error );
141
146
synchronized (lock ) {
142
147
lock .notifyAll ();
@@ -172,6 +177,7 @@ public void takePictureResponseErrorReceived(MALMessageHeader msgHeader, MALStan
172
177
173
178
@ Command (name = "get-status" , description = "Gets the provider status" )
174
179
public static class GetStatus extends BaseCommand implements Runnable {
180
+
175
181
@ Override
176
182
public void run () {
177
183
if (!super .initRemoteConsumer ()) {
@@ -215,8 +221,9 @@ public void run() {
215
221
216
222
@ Command (name = "get-nmea-sentence" , description = "Gets the NMEA sentence" )
217
223
public static class GetNMEASentence extends BaseCommand implements Runnable {
224
+
218
225
@ Parameters (arity = "1" , paramLabel = "<sentenceIdentifier>" , index = "0" ,
219
- description = "Identifier of the sentence" )
226
+ description = "Identifier of the sentence" )
220
227
String sentenceId ;
221
228
222
229
@ Override
@@ -239,7 +246,7 @@ public void run() {
239
246
gps .getNMEASentence (sentenceId , new GPSAdapter () {
240
247
@ Override
241
248
public void getNMEASentenceResponseReceived (MALMessageHeader msgHeader , String sentence ,
242
- Map qosProperties ) {
249
+ Map qosProperties ) {
243
250
System .out .println ("Sentence received: " + sentence );
244
251
245
252
synchronized (lock ) {
@@ -249,7 +256,7 @@ public void getNMEASentenceResponseReceived(MALMessageHeader msgHeader, String s
249
256
250
257
@ Override
251
258
public void getNMEASentenceResponseErrorReceived (MALMessageHeader msgHeader , MALStandardError error ,
252
- Map qosProperties ) {
259
+ Map qosProperties ) {
253
260
LOGGER .log (Level .SEVERE , "Error during getNMEASentence!" , error );
254
261
synchronized (lock ) {
255
262
lock .notifyAll ();
@@ -266,4 +273,3 @@ public void getNMEASentenceResponseErrorReceived(MALMessageHeader msgHeader, MAL
266
273
}
267
274
}
268
275
}
269
- //------------------------------------------------------------------------------
0 commit comments