@@ -207,7 +207,7 @@ class sensor : protected device {
207207
208208 // Command: write-only
209209 // Sends a command to the sensor.
210- auto set_command (std::string v) -> decltype(* this ) {
210+ sensor& set_command (std::string v) {
211211 set_attr_string (" command" , v);
212212 return *this ;
213213 }
@@ -231,7 +231,7 @@ class sensor : protected device {
231231 // Returns the current mode. Writing one of the values returned by `modes`
232232 // sets the sensor to that mode.
233233 std::string mode () const { return get_attr_string (" mode" ); }
234- auto set_mode (std::string v) -> decltype(* this ) {
234+ sensor& set_mode (std::string v) {
235235 set_attr_string (" mode" , v);
236236 return *this ;
237237 }
@@ -279,7 +279,7 @@ class i2c_sensor : public sensor {
279279 // coded as 50 msec. Returns -EOPNOTSUPP if changing polling is not supported.
280280 // Currently only I2C/NXT sensors support changing the polling period.
281281 int poll_ms () const { return get_attr_int (" poll_ms" ); }
282- auto set_poll_ms (int v) -> decltype(* this ) {
282+ i2c_sensor& set_poll_ms (int v) {
283283 set_attr_int (" poll_ms" , v);
284284 return *this ;
285285 }
@@ -684,7 +684,7 @@ class motor : protected device {
684684 // Command: write-only
685685 // Sends a command to the motor controller. See `commands` for a list of
686686 // possible values.
687- auto set_command (std::string v) -> decltype(* this ) {
687+ motor& set_command (std::string v) {
688688 set_attr_string (" command" , v);
689689 return *this ;
690690 }
@@ -737,7 +737,7 @@ class motor : protected device {
737737 // Units are in percent. Valid values are -100 to 100. A negative value causes
738738 // the motor to rotate in reverse.
739739 int duty_cycle_sp () const { return get_attr_int (" duty_cycle_sp" ); }
740- auto set_duty_cycle_sp (int v) -> decltype(* this ) {
740+ motor& set_duty_cycle_sp (int v) {
741741 set_attr_int (" duty_cycle_sp" , v);
742742 return *this ;
743743 }
@@ -754,7 +754,7 @@ class motor : protected device {
754754 // a positive duty cycle will cause the motor to rotate counter-clockwise.
755755 // Valid values are `normal` and `inversed`.
756756 std::string polarity () const { return get_attr_string (" polarity" ); }
757- auto set_polarity (std::string v) -> decltype(* this ) {
757+ motor& set_polarity (std::string v) {
758758 set_attr_string (" polarity" , v);
759759 return *this ;
760760 }
@@ -765,31 +765,31 @@ class motor : protected device {
765765 // Likewise, rotating counter-clockwise causes the position to decrease.
766766 // Writing will set the position to that value.
767767 int position () const { return get_attr_int (" position" ); }
768- auto set_position (int v) -> decltype(* this ) {
768+ motor& set_position (int v) {
769769 set_attr_int (" position" , v);
770770 return *this ;
771771 }
772772
773773 // Position P: read/write
774774 // The proportional constant for the position PID.
775775 int position_p () const { return get_attr_int (" hold_pid/Kp" ); }
776- auto set_position_p (int v) -> decltype(* this ) {
776+ motor& set_position_p (int v) {
777777 set_attr_int (" hold_pid/Kp" , v);
778778 return *this ;
779779 }
780780
781781 // Position I: read/write
782782 // The integral constant for the position PID.
783783 int position_i () const { return get_attr_int (" hold_pid/Ki" ); }
784- auto set_position_i (int v) -> decltype(* this ) {
784+ motor& set_position_i (int v) {
785785 set_attr_int (" hold_pid/Ki" , v);
786786 return *this ;
787787 }
788788
789789 // Position D: read/write
790790 // The derivative constant for the position PID.
791791 int position_d () const { return get_attr_int (" hold_pid/Kd" ); }
792- auto set_position_d (int v) -> decltype(* this ) {
792+ motor& set_position_d (int v) {
793793 set_attr_int (" hold_pid/Kd" , v);
794794 return *this ;
795795 }
@@ -800,7 +800,7 @@ class motor : protected device {
800800 // can use the value returned by `counts_per_rot` to convert tacho counts to/from
801801 // rotations or degrees.
802802 int position_sp () const { return get_attr_int (" position_sp" ); }
803- auto set_position_sp (int v) -> decltype(* this ) {
803+ motor& set_position_sp (int v) {
804804 set_attr_int (" position_sp" , v);
805805 return *this ;
806806 }
@@ -825,7 +825,7 @@ class motor : protected device {
825825 // RPM or deg/sec to tacho counts per second. Use the `count_per_m` attribute to
826826 // convert m/s to tacho counts per second.
827827 int speed_sp () const { return get_attr_int (" speed_sp" ); }
828- auto set_speed_sp (int v) -> decltype(* this ) {
828+ motor& set_speed_sp (int v) {
829829 set_attr_int (" speed_sp" , v);
830830 return *this ;
831831 }
@@ -837,7 +837,7 @@ class motor : protected device {
837837 // setpoint. The actual ramp time is the ratio of the difference between the
838838 // `speed_sp` and the current `speed` and max_speed multiplied by `ramp_up_sp`.
839839 int ramp_up_sp () const { return get_attr_int (" ramp_up_sp" ); }
840- auto set_ramp_up_sp (int v) -> decltype(* this ) {
840+ motor& set_ramp_up_sp (int v) {
841841 set_attr_int (" ramp_up_sp" , v);
842842 return *this ;
843843 }
@@ -849,31 +849,31 @@ class motor : protected device {
849849 // setpoint. The actual ramp time is the ratio of the difference between the
850850 // `speed_sp` and the current `speed` and max_speed multiplied by `ramp_down_sp`.
851851 int ramp_down_sp () const { return get_attr_int (" ramp_down_sp" ); }
852- auto set_ramp_down_sp (int v) -> decltype(* this ) {
852+ motor& set_ramp_down_sp (int v) {
853853 set_attr_int (" ramp_down_sp" , v);
854854 return *this ;
855855 }
856856
857857 // Speed P: read/write
858858 // The proportional constant for the speed regulation PID.
859859 int speed_p () const { return get_attr_int (" speed_pid/Kp" ); }
860- auto set_speed_p (int v) -> decltype(* this ) {
860+ motor& set_speed_p (int v) {
861861 set_attr_int (" speed_pid/Kp" , v);
862862 return *this ;
863863 }
864864
865865 // Speed I: read/write
866866 // The integral constant for the speed regulation PID.
867867 int speed_i () const { return get_attr_int (" speed_pid/Ki" ); }
868- auto set_speed_i (int v) -> decltype(* this ) {
868+ motor& set_speed_i (int v) {
869869 set_attr_int (" speed_pid/Ki" , v);
870870 return *this ;
871871 }
872872
873873 // Speed D: read/write
874874 // The derivative constant for the speed regulation PID.
875875 int speed_d () const { return get_attr_int (" speed_pid/Kd" ); }
876- auto set_speed_d (int v) -> decltype(* this ) {
876+ motor& set_speed_d (int v) {
877877 set_attr_int (" speed_pid/Kd" , v);
878878 return *this ;
879879 }
@@ -889,7 +889,7 @@ class motor : protected device {
889889 // Also, it determines the motors behavior when a run command completes. See
890890 // `stop_actions` for a list of possible values.
891891 std::string stop_action () const { return get_attr_string (" stop_action" ); }
892- auto set_stop_action (std::string v) -> decltype(* this ) {
892+ motor& set_stop_action (std::string v) {
893893 set_attr_string (" stop_action" , v);
894894 return *this ;
895895 }
@@ -912,7 +912,7 @@ class motor : protected device {
912912 // `run-timed` command. Reading returns the current value. Units are in
913913 // milliseconds.
914914 int time_sp () const { return get_attr_int (" time_sp" ); }
915- auto set_time_sp (int v) -> decltype(* this ) {
915+ motor& set_time_sp (int v) {
916916 set_attr_int (" time_sp" , v);
917917 return *this ;
918918 }
@@ -1030,7 +1030,7 @@ class dc_motor : protected device {
10301030 // Sets the command for the motor. Possible values are `run-forever`, `run-timed` and
10311031 // `stop`. Not all commands may be supported, so be sure to check the contents
10321032 // of the `commands` attribute.
1033- auto set_command (std::string v) -> decltype(* this ) {
1033+ dc_motor& set_command (std::string v) {
10341034 set_attr_string (" command" , v);
10351035 return *this ;
10361036 }
@@ -1055,15 +1055,15 @@ class dc_motor : protected device {
10551055 // Valid values are -100 to 100 (-100% to 100%). Reading returns the current
10561056 // setpoint.
10571057 int duty_cycle_sp () const { return get_attr_int (" duty_cycle_sp" ); }
1058- auto set_duty_cycle_sp (int v) -> decltype(* this ) {
1058+ dc_motor& set_duty_cycle_sp (int v) {
10591059 set_attr_int (" duty_cycle_sp" , v);
10601060 return *this ;
10611061 }
10621062
10631063 // Polarity: read/write
10641064 // Sets the polarity of the motor. Valid values are `normal` and `inversed`.
10651065 std::string polarity () const { return get_attr_string (" polarity" ); }
1066- auto set_polarity (std::string v) -> decltype(* this ) {
1066+ dc_motor& set_polarity (std::string v) {
10671067 set_attr_string (" polarity" , v);
10681068 return *this ;
10691069 }
@@ -1072,7 +1072,7 @@ class dc_motor : protected device {
10721072 // Sets the time in milliseconds that it take the motor to ramp down from 100%
10731073 // to 0%. Valid values are 0 to 10000 (10 seconds). Default is 0.
10741074 int ramp_down_sp () const { return get_attr_int (" ramp_down_sp" ); }
1075- auto set_ramp_down_sp (int v) -> decltype(* this ) {
1075+ dc_motor& set_ramp_down_sp (int v) {
10761076 set_attr_int (" ramp_down_sp" , v);
10771077 return *this ;
10781078 }
@@ -1081,7 +1081,7 @@ class dc_motor : protected device {
10811081 // Sets the time in milliseconds that it take the motor to up ramp from 0% to
10821082 // 100%. Valid values are 0 to 10000 (10 seconds). Default is 0.
10831083 int ramp_up_sp () const { return get_attr_int (" ramp_up_sp" ); }
1084- auto set_ramp_up_sp (int v) -> decltype(* this ) {
1084+ dc_motor& set_ramp_up_sp (int v) {
10851085 set_attr_int (" ramp_up_sp" , v);
10861086 return *this ;
10871087 }
@@ -1096,7 +1096,7 @@ class dc_motor : protected device {
10961096 // Stop Action: write-only
10971097 // Sets the stop action that will be used when the motor stops. Read
10981098 // `stop_actions` to get the list of valid values.
1099- auto set_stop_action (std::string v) -> decltype(* this ) {
1099+ dc_motor& set_stop_action (std::string v) {
11001100 set_attr_string (" stop_action" , v);
11011101 return *this ;
11021102 }
@@ -1111,7 +1111,7 @@ class dc_motor : protected device {
11111111 // `run-timed` command. Reading returns the current value. Units are in
11121112 // milliseconds.
11131113 int time_sp () const { return get_attr_int (" time_sp" ); }
1114- auto set_time_sp (int v) -> decltype(* this ) {
1114+ dc_motor& set_time_sp (int v) {
11151115 set_attr_int (" time_sp" , v);
11161116 return *this ;
11171117 }
@@ -1171,7 +1171,7 @@ class servo_motor : protected device {
11711171 // Sets the command for the servo. Valid values are `run` and `float`. Setting
11721172 // to `run` will cause the servo to be driven to the position_sp set in the
11731173 // `position_sp` attribute. Setting to `float` will remove power from the motor.
1174- auto set_command (std::string v) -> decltype(* this ) {
1174+ servo_motor& set_command (std::string v) {
11751175 set_attr_string (" command" , v);
11761176 return *this ;
11771177 }
@@ -1187,7 +1187,7 @@ class servo_motor : protected device {
11871187 // Valid values are 2300 to 2700. You must write to the position_sp attribute for
11881188 // changes to this attribute to take effect.
11891189 int max_pulse_sp () const { return get_attr_int (" max_pulse_sp" ); }
1190- auto set_max_pulse_sp (int v) -> decltype(* this ) {
1190+ servo_motor& set_max_pulse_sp (int v) {
11911191 set_attr_int (" max_pulse_sp" , v);
11921192 return *this ;
11931193 }
@@ -1200,7 +1200,7 @@ class servo_motor : protected device {
12001200 // where the motor does not turn. You must write to the position_sp attribute for
12011201 // changes to this attribute to take effect.
12021202 int mid_pulse_sp () const { return get_attr_int (" mid_pulse_sp" ); }
1203- auto set_mid_pulse_sp (int v) -> decltype(* this ) {
1203+ servo_motor& set_mid_pulse_sp (int v) {
12041204 set_attr_int (" mid_pulse_sp" , v);
12051205 return *this ;
12061206 }
@@ -1211,7 +1211,7 @@ class servo_motor : protected device {
12111211 // is 600. Valid values are 300 to 700. You must write to the position_sp
12121212 // attribute for changes to this attribute to take effect.
12131213 int min_pulse_sp () const { return get_attr_int (" min_pulse_sp" ); }
1214- auto set_min_pulse_sp (int v) -> decltype(* this ) {
1214+ servo_motor& set_min_pulse_sp (int v) {
12151215 set_attr_int (" min_pulse_sp" , v);
12161216 return *this ;
12171217 }
@@ -1222,7 +1222,7 @@ class servo_motor : protected device {
12221222 // inversed. i.e `-100` will correspond to `max_pulse_sp`, and `100` will
12231223 // correspond to `min_pulse_sp`.
12241224 std::string polarity () const { return get_attr_string (" polarity" ); }
1225- auto set_polarity (std::string v) -> decltype(* this ) {
1225+ servo_motor& set_polarity (std::string v) {
12261226 set_attr_string (" polarity" , v);
12271227 return *this ;
12281228 }
@@ -1233,7 +1233,7 @@ class servo_motor : protected device {
12331233 // are -100 to 100 (-100% to 100%) where `-100` corresponds to `min_pulse_sp`,
12341234 // `0` corresponds to `mid_pulse_sp` and `100` corresponds to `max_pulse_sp`.
12351235 int position_sp () const { return get_attr_int (" position_sp" ); }
1236- auto set_position_sp (int v) -> decltype(* this ) {
1236+ servo_motor& set_position_sp (int v) {
12371237 set_attr_int (" position_sp" , v);
12381238 return *this ;
12391239 }
@@ -1246,7 +1246,7 @@ class servo_motor : protected device {
12461246 // case reading and writing will fail with `-EOPNOTSUPP`. In continuous rotation
12471247 // servos, this value will affect the rate_sp at which the speed ramps up or down.
12481248 int rate_sp () const { return get_attr_int (" rate_sp" ); }
1249- auto set_rate_sp (int v) -> decltype(* this ) {
1249+ servo_motor& set_rate_sp (int v) {
12501250 set_attr_int (" rate_sp" , v);
12511251 return *this ;
12521252 }
@@ -1283,7 +1283,7 @@ class led : protected device {
12831283 // Brightness: read/write
12841284 // Sets the brightness level. Possible values are from 0 to `max_brightness`.
12851285 int brightness () const { return get_attr_int (" brightness" ); }
1286- auto set_brightness (int v) -> decltype(* this ) {
1286+ led set_brightness (int v) {
12871287 set_attr_int (" brightness" , v);
12881288 return *this ;
12891289 }
@@ -1308,7 +1308,7 @@ class led : protected device {
13081308 // trigger. However, if you set the brightness value to 0 it will
13091309 // also disable the `timer` trigger.
13101310 std::string trigger () const { return get_attr_from_set (" trigger" ); }
1311- auto set_trigger (std::string v) -> decltype(* this ) {
1311+ led set_trigger (std::string v) {
13121312 set_attr_string (" trigger" , v);
13131313 return *this ;
13141314 }
@@ -1318,7 +1318,7 @@ class led : protected device {
13181318 // 0 and the current brightness setting. The `on` time can
13191319 // be specified via `delay_on` attribute in milliseconds.
13201320 int delay_on () const { return get_attr_int (" delay_on" ); }
1321- auto set_delay_on (int v) -> decltype(* this ) {
1321+ led set_delay_on (int v) {
13221322 set_attr_int (" delay_on" , v);
13231323 return *this ;
13241324 }
@@ -1328,7 +1328,7 @@ class led : protected device {
13281328 // 0 and the current brightness setting. The `off` time can
13291329 // be specified via `delay_off` attribute in milliseconds.
13301330 int delay_off () const { return get_attr_int (" delay_off" ); }
1331- auto set_delay_off (int v) -> decltype(* this ) {
1331+ led set_delay_off (int v) {
13321332 set_attr_int (" delay_off" , v);
13331333 return *this ;
13341334 }
@@ -1340,7 +1340,7 @@ class led : protected device {
13401340 }
13411341
13421342 // Sets the LED's brightness as a percentage (0-1) of the maximum.
1343- auto set_brightness_pct (float v) -> decltype(* this ) {
1343+ led set_brightness_pct (float v) {
13441344 return set_brightness (v * max_brightness ());
13451345 }
13461346
@@ -1640,7 +1640,7 @@ class lego_port : protected device {
16401640 // associated with the port will be removed new ones loaded, however this
16411641 // this will depend on the individual driver implementing this class.
16421642 std::string mode () const { return get_attr_string (" mode" ); }
1643- auto set_mode (std::string v) -> decltype(* this ) {
1643+ lego_port set_mode (std::string v) {
16441644 set_attr_string (" mode" , v);
16451645 return *this ;
16461646 }
@@ -1651,7 +1651,7 @@ class lego_port : protected device {
16511651 // example, since NXT/Analog sensors cannot be auto-detected, you must use
16521652 // this attribute to load the correct driver. Returns -EOPNOTSUPP if setting a
16531653 // device is not supported.
1654- auto set_set_device (std::string v) -> decltype(* this ) {
1654+ lego_port set_set_device (std::string v) {
16551655 set_attr_string (" set_device" , v);
16561656 return *this ;
16571657 }
0 commit comments