@@ -357,6 +357,28 @@ bool Command::InitArgument(size_t argIndex, char * argValue)
357
357
break ;
358
358
}
359
359
360
+ case ArgumentType::Float: {
361
+ if (arg.optional )
362
+ arg.value = &(static_cast <chip::Optional<float > *>(arg.value ))->Emplace ();
363
+ float * value = static_cast <float *>(arg.value );
364
+ std::stringstream ss;
365
+ ss << argValue;
366
+ ss >> *value;
367
+ isValidArgument = (!ss.fail () && ss.eof ());
368
+ break ;
369
+ }
370
+
371
+ case ArgumentType::Double: {
372
+ if (arg.optional )
373
+ arg.value = &(static_cast <chip::Optional<double > *>(arg.value ))->Emplace ();
374
+ double * value = static_cast <double *>(arg.value );
375
+ std::stringstream ss;
376
+ ss << argValue;
377
+ ss >> *value;
378
+ isValidArgument = (!ss.fail () && ss.eof ());
379
+ break ;
380
+ }
381
+
360
382
case ArgumentType::Address: {
361
383
if (arg.optional )
362
384
arg.value = &(reinterpret_cast <chip::Optional<AddressWithInterface> *>(arg.value ))->Emplace ();
@@ -429,6 +451,30 @@ size_t Command::AddArgument(const char * name, AddressWithInterface * out, bool
429
451
return AddArgumentToList (std::move (arg));
430
452
}
431
453
454
+ size_t Command::AddArgument (const char * name, float min, float max, float * out, bool optional)
455
+ {
456
+ Argument arg;
457
+ arg.type = ArgumentType::Float;
458
+ arg.name = name;
459
+ arg.value = reinterpret_cast <void *>(out);
460
+ arg.optional = optional;
461
+ // Ignore min/max for now; they're always +-Infinity anyway.
462
+
463
+ return AddArgumentToList (std::move (arg));
464
+ }
465
+
466
+ size_t Command::AddArgument (const char * name, double min, double max, double * out, bool optional)
467
+ {
468
+ Argument arg;
469
+ arg.type = ArgumentType::Double;
470
+ arg.name = name;
471
+ arg.value = reinterpret_cast <void *>(out);
472
+ arg.optional = optional;
473
+ // Ignore min/max for now; they're always +-Infinity anyway.
474
+
475
+ return AddArgumentToList (std::move (arg));
476
+ }
477
+
432
478
size_t Command::AddArgument (const char * name, int64_t min, uint64_t max, void * out, ArgumentType type, bool optional)
433
479
{
434
480
Argument arg;
0 commit comments