@ -33,7 +33,7 @@ namespace raise {
# define RAISE_FIRMWARE_VERSION "<unknown>"
# define RAISE_FIRMWARE_VERSION "<unknown>"
# endif
# endif
EventHandlerResult Focus : : onFocusEvent ( const char * command ) {
EventHandlerResult Focus : : onFocusEvent ( const char * input ) {
const char * cmd_version = PSTR ( " hardware.version " ) ;
const char * cmd_version = PSTR ( " hardware.version " ) ;
const char * cmd_side_power = PSTR ( " hardware.side_power " ) ;
const char * cmd_side_power = PSTR ( " hardware.side_power " ) ;
const char * cmd_side_ver = PSTR ( " hardware.side_ver " ) ;
const char * cmd_side_ver = PSTR ( " hardware.side_ver " ) ;
@ -44,7 +44,8 @@ EventHandlerResult Focus::onFocusEvent(const char *command) {
const char * cmd_keyscan = PSTR ( " hardware.keyscan " ) ;
const char * cmd_keyscan = PSTR ( " hardware.keyscan " ) ;
const char * cmd_crc_errors = PSTR ( " hardware.crc_errors " ) ;
const char * cmd_crc_errors = PSTR ( " hardware.crc_errors " ) ;
const char * cmd_firmware = PSTR ( " hardware.firmware " ) ;
const char * cmd_firmware = PSTR ( " hardware.firmware " ) ;
if ( : : Focus . inputMatchesHelp ( command ) )
if ( : : Focus . inputMatchesHelp ( input ) )
return : : Focus . printHelp ( cmd_version ,
return : : Focus . printHelp ( cmd_version ,
cmd_side_power ,
cmd_side_power ,
cmd_side_ver ,
cmd_side_ver ,
@ -56,13 +57,13 @@ EventHandlerResult Focus::onFocusEvent(const char *command) {
cmd_crc_errors ,
cmd_crc_errors ,
cmd_firmware ) ;
cmd_firmware ) ;
if ( : : Focus . inputMatchesCommand ( command , cmd_version ) ) {
if ( : : Focus . inputMatchesCommand ( input , cmd_version ) ) {
: : Focus . send ( " Dygma Raise " ) ;
: : Focus . send ( " Dygma Raise " ) ;
return EventHandlerResult : : EVENT_CONSUMED ;
return EventHandlerResult : : EVENT_CONSUMED ;
} else if ( : : Focus . inputMatchesCommand ( command , cmd_firmware ) ) {
} else if ( : : Focus . inputMatchesCommand ( input , cmd_firmware ) ) {
: : Focus . send ( RAISE_FIRMWARE_VERSION ) ;
: : Focus . send ( RAISE_FIRMWARE_VERSION ) ;
return EventHandlerResult : : EVENT_CONSUMED ;
return EventHandlerResult : : EVENT_CONSUMED ;
} else if ( : : Focus . inputMatchesCommand ( command , cmd_side_power ) ) {
} else if ( : : Focus . inputMatchesCommand ( input , cmd_side_power ) ) {
if ( : : Focus . isEOL ( ) ) {
if ( : : Focus . isEOL ( ) ) {
: : Focus . send ( Runtime . device ( ) . side . getPower ( ) ) ;
: : Focus . send ( Runtime . device ( ) . side . getPower ( ) ) ;
return EventHandlerResult : : EVENT_CONSUMED ;
return EventHandlerResult : : EVENT_CONSUMED ;
@ -72,25 +73,25 @@ EventHandlerResult Focus::onFocusEvent(const char *command) {
Runtime . device ( ) . side . setPower ( power ) ;
Runtime . device ( ) . side . setPower ( power ) ;
return EventHandlerResult : : EVENT_CONSUMED ;
return EventHandlerResult : : EVENT_CONSUMED ;
}
}
} else if ( : : Focus . inputMatchesCommand ( command , cmd_side_ver ) ) {
} else if ( : : Focus . inputMatchesCommand ( input , cmd_side_ver ) ) {
: : Focus . send ( " left: " ) ;
: : Focus . send ( " left: " ) ;
: : Focus . send ( Runtime . device ( ) . side . leftVersion ( ) ) ;
: : Focus . send ( Runtime . device ( ) . side . leftVersion ( ) ) ;
: : Focus . send ( " \r \n right: " ) ;
: : Focus . send ( " \r \n right: " ) ;
: : Focus . send ( Runtime . device ( ) . side . rightVersion ( ) ) ;
: : Focus . send ( Runtime . device ( ) . side . rightVersion ( ) ) ;
return EventHandlerResult : : EVENT_CONSUMED ;
return EventHandlerResult : : EVENT_CONSUMED ;
} else if ( : : Focus . inputMatchesCommand ( command , cmd_crc_errors ) ) {
} else if ( : : Focus . inputMatchesCommand ( input , cmd_crc_errors ) ) {
: : Focus . send ( " left: " ) ;
: : Focus . send ( " left: " ) ;
: : Focus . send ( Runtime . device ( ) . side . leftCRCErrors ( ) ) ;
: : Focus . send ( Runtime . device ( ) . side . leftCRCErrors ( ) ) ;
: : Focus . send ( " \r \n right: " ) ;
: : Focus . send ( " \r \n right: " ) ;
: : Focus . send ( Runtime . device ( ) . side . rightCRCErrors ( ) ) ;
: : Focus . send ( Runtime . device ( ) . side . rightCRCErrors ( ) ) ;
return EventHandlerResult : : EVENT_CONSUMED ;
return EventHandlerResult : : EVENT_CONSUMED ;
} else if ( : : Focus . inputMatchesCommand ( command , cmd_sled_ver ) ) {
} else if ( : : Focus . inputMatchesCommand ( input , cmd_sled_ver ) ) {
: : Focus . send ( " left: " ) ;
: : Focus . send ( " left: " ) ;
: : Focus . send ( Runtime . device ( ) . side . leftSLEDVersion ( ) ) ;
: : Focus . send ( Runtime . device ( ) . side . leftSLEDVersion ( ) ) ;
: : Focus . send ( " \r \n right: " ) ;
: : Focus . send ( " \r \n right: " ) ;
: : Focus . send ( Runtime . device ( ) . side . rightSLEDVersion ( ) ) ;
: : Focus . send ( Runtime . device ( ) . side . rightSLEDVersion ( ) ) ;
return EventHandlerResult : : EVENT_CONSUMED ;
return EventHandlerResult : : EVENT_CONSUMED ;
} else if ( : : Focus . inputMatchesCommand ( command , cmd_sled_current ) ) {
} else if ( : : Focus . inputMatchesCommand ( input , cmd_sled_current ) ) {
if ( : : Focus . isEOL ( ) ) {
if ( : : Focus . isEOL ( ) ) {
: : Focus . send ( " left: " ) ;
: : Focus . send ( " left: " ) ;
: : Focus . send ( Runtime . device ( ) . side . leftSLEDCurrent ( ) ) ;
: : Focus . send ( Runtime . device ( ) . side . leftSLEDCurrent ( ) ) ;
@ -103,14 +104,14 @@ EventHandlerResult Focus::onFocusEvent(const char *command) {
Runtime . device ( ) . side . setSLEDCurrent ( current ) ;
Runtime . device ( ) . side . setSLEDCurrent ( current ) ;
return EventHandlerResult : : EVENT_CONSUMED ;
return EventHandlerResult : : EVENT_CONSUMED ;
}
}
} else if ( : : Focus . inputMatchesCommand ( command , cmd_layout ) ) {
} else if ( : : Focus . inputMatchesCommand ( input , cmd_layout ) ) {
static const auto ANSI = Runtime . device ( ) . settings . Layout : : ANSI ;
static const auto ANSI = Runtime . device ( ) . settings . Layout : : ANSI ;
: : Focus . send ( Runtime . device ( ) . settings . layout ( ) = = ANSI ? " ANSI " : " ISO " ) ;
: : Focus . send ( Runtime . device ( ) . settings . layout ( ) = = ANSI ? " ANSI " : " ISO " ) ;
return EventHandlerResult : : EVENT_CONSUMED ;
return EventHandlerResult : : EVENT_CONSUMED ;
} else if ( : : Focus . inputMatchesCommand ( command , cmd_joint ) ) {
} else if ( : : Focus . inputMatchesCommand ( input , cmd_joint ) ) {
: : Focus . send ( Runtime . device ( ) . settings . joint ( ) ) ;
: : Focus . send ( Runtime . device ( ) . settings . joint ( ) ) ;
return EventHandlerResult : : EVENT_CONSUMED ;
return EventHandlerResult : : EVENT_CONSUMED ;
} else if ( : : Focus . inputMatchesCommand ( command , cmd_keyscan ) ) {
} else if ( : : Focus . inputMatchesCommand ( input , cmd_keyscan ) ) {
if ( : : Focus . isEOL ( ) ) {
if ( : : Focus . isEOL ( ) ) {
: : Focus . send ( Runtime . device ( ) . settings . keyscanInterval ( ) ) ;
: : Focus . send ( Runtime . device ( ) . settings . keyscanInterval ( ) ) ;
return EventHandlerResult : : EVENT_CONSUMED ;
return EventHandlerResult : : EVENT_CONSUMED ;