ESP3D  3.0
Firmware for ESP boards connected to 3D Printer
ESP290.cpp
Go to the documentation of this file.
1 /*
2  ESP290.cpp - ESP3D command class
3 
4  Copyright (c) 2014 Luc Lebosse. All rights reserved.
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Lesser General Public
8  License as published by the Free Software Foundation; either
9  version 2.1 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Lesser General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public
17  License along with this library; if not, write to the Free Software
18  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20 #include "../../include/esp3d_config.h"
21 #include "../commands.h"
22 #include "../../modules/authentication/authentication_service.h"
23 #include "../esp3doutput.h"
24 //Delay command
25 //[ESP290]<delay in ms>[pwd=<user password>]
26 bool Commands::ESP290(const char* cmd_params, level_authenticate_type auth_type, ESP3DOutput * output)
27 {
28  bool response = true;
29  String parameter;
30 #ifdef AUTHENTICATION_FEATURE
31  if (auth_type == LEVEL_GUEST) {
32  output->printERROR("Wrong authentication!", 401);
33  return false;
34  }
35 #else
36  (void)auth_type;
37 #endif //AUTHENTICATION_FEATURE
38  parameter = get_param (cmd_params, "");
39  //get time
40  if (parameter.length() != 0) {
41  output->printMSG ("Pause");
42  Hal::wait(parameter.toInt());
43  }
44  output->printMSG ("ok");
45  return response;
46 }
Commands::get_param
const char * get_param(const char *cmd_params, const char *label)
Definition: commands.cpp:162
Hal::wait
static void wait(uint32_t milliseconds)
Definition: hal.cpp:226
LEVEL_GUEST
@ LEVEL_GUEST
Definition: authentication_service.h:26
level_authenticate_type
level_authenticate_type
Definition: authentication_service.h:25
ESP3DOutput::printMSG
size_t printMSG(const char *s, bool withNL=true)
Definition: esp3doutput.cpp:190
ESP3DOutput::printERROR
size_t printERROR(const char *s, int code_error=200)
Definition: esp3doutput.cpp:247
Commands::ESP290
bool ESP290(const char *cmd_params, level_authenticate_type auth_level, ESP3DOutput *output)
Definition: ESP290.cpp:26
ESP3DOutput
Definition: esp3doutput.h:48