Changeset View
Standalone View
src/atcore.h
Show First 20 Lines • Show All 53 Lines • ▼ Show 20 Line(s) | 53 | { | |||
---|---|---|---|---|---|
54 | Q_OBJECT | 54 | Q_OBJECT | ||
55 | Q_PROPERTY(QString version READ version) | 55 | Q_PROPERTY(QString version READ version) | ||
56 | Q_PROPERTY(QStringList availableFirmwarePlugins READ availableFirmwarePlugins) | 56 | Q_PROPERTY(QStringList availableFirmwarePlugins READ availableFirmwarePlugins) | ||
57 | Q_PROPERTY(quint16 serialTimerInterval READ serialTimerInterval WRITE setSerialTimerInterval) | 57 | Q_PROPERTY(quint16 serialTimerInterval READ serialTimerInterval WRITE setSerialTimerInterval) | ||
58 | Q_PROPERTY(QStringList serialPorts READ serialPorts NOTIFY portsChanged) | 58 | Q_PROPERTY(QStringList serialPorts READ serialPorts NOTIFY portsChanged) | ||
59 | Q_PROPERTY(QStringList portSpeeds READ portSpeeds) | 59 | Q_PROPERTY(QStringList portSpeeds READ portSpeeds) | ||
60 | Q_PROPERTY(QString connectedPort READ connectedPort) | 60 | Q_PROPERTY(QString connectedPort READ connectedPort) | ||
61 | Q_PROPERTY(AtCore::STATES state READ state WRITE setState NOTIFY stateChanged) | 61 | Q_PROPERTY(AtCore::STATES state READ state WRITE setState NOTIFY stateChanged) | ||
62 | Q_PROPERTY(bool sdMount READ isSdMounted WRITE setsdMounted NOTIFY sdMountChanged) | ||||
63 | Q_PROPERTY(QStringList sdFileList READ sdFileList NOTIFY sdCardFileListChanged) | ||||
62 | public: | 64 | public: | ||
63 | /** | 65 | /** | ||
64 | * @brief STATES enum Possible states the printer can be in | 66 | * @brief STATES enum Possible states the printer can be in | ||
patrickelectric: I'm a bit lost, what is the problem to use it with public functions ? | |||||
Its not However this will prevent any use of the internal sd functions to be used for general use. Tomaz was worried about exposure and after thinking abut I decided it was safest to move all the functions we intend the plugins to use to protected so they are in one spot and can be used only by the friends classes rizzitello: Its not However this will prevent any use of the internal sd functions to be used for general… | |||||
65 | */ | 67 | */ | ||
66 | enum STATES { | 68 | enum STATES { | ||
67 | DISCONNECTED, //!< Not Connected to a printer, initial state | 69 | DISCONNECTED, //!< Not Connected to a printer, initial state | ||
68 | CONNECTING, //!<Attempting to connect, Fw not probed | 70 | CONNECTING, //!<Attempting to connect, Fw not probed | ||
69 | IDLE, //!<Connected to printer and ready for commands | 71 | IDLE, //!<Connected to printer and ready for commands | ||
70 | BUSY, //!<Printer is Printing or working | 72 | BUSY, //!<Printer is Printing or working | ||
71 | PAUSE, //!<Printer is paused | 73 | PAUSE, //!<Printer is paused | ||
72 | ERRORSTATE, //!<Printer Returned Error | 74 | ERRORSTATE, //!<Printer Returned Error | ||
▲ Show 20 Lines • Show All 122 Lines • ▼ Show 20 Line(s) | |||||
195 | */ | 197 | */ | ||
196 | Temperature &temperature() const; | 198 | Temperature &temperature() const; | ||
197 | 199 | | |||
198 | /** | 200 | /** | ||
199 | * @brief Return the amount of miliseconds the serialTimer is set to. 0 = Disabled | 201 | * @brief Return the amount of miliseconds the serialTimer is set to. 0 = Disabled | ||
200 | */ | 202 | */ | ||
201 | quint16 serialTimerInterval() const; | 203 | quint16 serialTimerInterval() const; | ||
202 | 204 | | |||
205 | /** | ||||
206 | * @brief Attempt to Mount an sd card | ||||
207 | * @param slot: Sd card Slot on machine (0 is default) | ||||
208 | */ | ||||
209 | void mountSd(int slot = 0); | ||||
it's an attempt, this means that it can fail. return false on failure and true on success. tcanabrava: it's an attempt, this means that it can fail. return false on failure and true on success.
| |||||
if the mount fails it returns ok if the mount works it returns ok .. we have no way to return worked or didn't . aside from that atcore is not set in such a way that it can evaulate returns of commands it sends within the function it sends them in . All evalutation of returned messages happen in AtCore::newMessage and IFirmware::validateMessage. rizzitello: if the mount fails it returns ok if the mount works it returns ok .. we have no way to return… | |||||
210 | | ||||
211 | /** | ||||
212 | * @brief Attempt to Unmount an sd card | ||||
213 | * @param slot: Sd card Slot on machine (0 is default) | ||||
214 | */ | ||||
215 | void umountSd(int slot = 0); | ||||
it's an attempt, this can fail. return false on failure and true on success. tcanabrava: it's an attempt, this can fail. return false on failure and true on success. | |||||
rizzitello: same as above. | |||||
216 | | ||||
217 | /** | ||||
218 | * @brief sdFileList | ||||
219 | * @return List of files on the sd card. | ||||
220 | */ | ||||
221 | QStringList sdFileList(); | ||||
222 | | ||||
223 | /** | ||||
224 | * @brief adds a file to the Sd cards file list held by AtCore. | ||||
225 | * @param fileName: new FileName | ||||
226 | */ | ||||
227 | void appendSdCardFileList(const QString fileName); | ||||
228 | | ||||
229 | /** | ||||
230 | * @brief clear the sd card file list held by AtCore. | ||||
231 | */ | ||||
232 | void clearSdCardFileList(); | ||||
233 | | ||||
234 | /** | ||||
235 | * @brief Check if an sd card is mounted on the printer | ||||
236 | * @return True if card mounted | ||||
237 | */ | ||||
238 | bool isSdMounted(); | ||||
239 | | ||||
240 | /** | ||||
241 | * @brief Set if the sd card is mounted by the printer | ||||
242 | * @param mounted: True is mounted | ||||
243 | */ | ||||
244 | void setSdMounted(const bool mounted); | ||||
hm? this is a really weird call. tcanabrava: hm? this is a really weird call.
why this is not handled internally or using mount() and… | |||||
This is set by the firmware plugin . when messages are seen emited from the printer. This is now external because all Sd card support has been moved to firmware plugins. mount and unmount send commands.. and they do not always provide the desired result. for instance if you have a printer with autodetect and you try to unmount it will unmount the card and instantly remount it. trying to send a mount command with a card inserted does nothing. most firmware support auto/mount and unmount by default for sd card readers. rizzitello: This is set by the firmware plugin . when messages are seen emited from the printer. This is… | |||||
245 | | ||||
246 | /** | ||||
247 | * @brief readingSdCardList | ||||
248 | * @return True if printer is returning sd card file list | ||||
249 | */ | ||||
250 | bool readingSdCardList(); | ||||
tcanabrava: bool isReadingSdCardList() const; | |||||
251 | | ||||
252 | /** | ||||
253 | * @brief setReadingSdCardList | ||||
254 | * @param readingList True if reading file list | ||||
255 | */ | ||||
256 | void setReadingSdCardList(bool readingList); | ||||
tcanabrava: why this is set from outside? | |||||
Sd Card support is done buy firmware plugins . This is set by the firmware plugin when specific messages are recviced from the printer to indicate that is starting to send the file list and has finished sending the file list. rizzitello: Sd Card support is done buy firmware plugins . This is set by the firmware plugin when specific… | |||||
257 | | ||||
203 | signals: | 258 | signals: | ||
204 | 259 | | |||
205 | /** | 260 | /** | ||
206 | * @brief Print job's precentage changed. | 261 | * @brief Print job's precentage changed. | ||
207 | * @param newProgress : Message | 262 | * @param newProgress : Message | ||
208 | * @sa percentagePrinted() | 263 | * @sa percentagePrinted() | ||
209 | */ | 264 | */ | ||
210 | void printProgressChanged(const float &newProgress); | 265 | void printProgressChanged(const float &newProgress); | ||
Show All 9 Lines | |||||
220 | * @param newState : the new state of the printer | 275 | * @param newState : the new state of the printer | ||
221 | * @sa setState(),state(),AtCore::STATES | 276 | * @sa setState(),state(),AtCore::STATES | ||
222 | */ | 277 | */ | ||
223 | void stateChanged(AtCore::STATES newState); | 278 | void stateChanged(AtCore::STATES newState); | ||
224 | 279 | | |||
225 | /** | 280 | /** | ||
226 | * @brief Available serialports Changed | 281 | * @brief Available serialports Changed | ||
227 | */ | 282 | */ | ||
228 | void portsChanged(QStringList); | 283 | void portsChanged(const QStringList postList); | ||
284 | | ||||
285 | /** | ||||
286 | * @brief Sd Card Mount Changed | ||||
287 | */ | ||||
288 | void sdMountChanged(bool newState); | ||||
289 | | ||||
290 | /** | ||||
291 | * @brief The files on the sd card have changed. | ||||
292 | */ | ||||
293 | void sdCardFileListChanged(const QStringList fileList); | ||||
tcanabrava: const-ref | |||||
229 | 294 | | |||
230 | public slots: | 295 | public slots: | ||
231 | 296 | | |||
232 | /** | 297 | /** | ||
233 | * @brief Set the printers state | 298 | * @brief Set the printers state | ||
This header usually have the parameter name, and not only the type of it. Try to maintain the convention. patrickelectric: This header usually have the parameter name, and not only the type of it. Try to maintain the… | |||||
234 | * @param state : printer state. | 299 | * @param state : printer state. | ||
235 | * @sa state(),stateChanged(),AtCore::STATES | 300 | * @sa state(),stateChanged(),AtCore::STATES | ||
236 | */ | 301 | */ | ||
237 | void setState(AtCore::STATES state); | 302 | void setState(AtCore::STATES state); | ||
238 | 303 | | |||
239 | /** | 304 | /** | ||
240 | * @brief Push a command into the command queue | 305 | * @brief Push a command into the command queue | ||
241 | * | 306 | * | ||
242 | * @param comm : Command | 307 | * @param comm : Command | ||
243 | */ | 308 | */ | ||
244 | void pushCommand(const QString &comm); | 309 | void pushCommand(const QString &comm); | ||
245 | 310 | | |||
246 | /** | 311 | /** | ||
247 | * @brief Public Interface for printing a file | 312 | * @brief Public Interface for printing a file | ||
248 | * @param fileName: the gcode file to print. | 313 | * @param fileName: the gcode file to print. | ||
314 | * @param sdPrint: set true to print fileName from Sd card | ||||
249 | */ | 315 | */ | ||
250 | void print(const QString &fileName); | 316 | void print(const QString &fileName, bool sdPrint); | ||
tcanabrava: why the bool? can we call this with print = false? | |||||
you can printer exactly as you were before the bool will default to false if not present and if present tells atcore to not start a print thread but instead start printing "fileName" from the sd card. rizzitello: you can printer exactly as you were before the bool will default to false if not present and if… | |||||
251 | 317 | | |||
252 | /** | 318 | /** | ||
253 | * @brief Stop the Printer by empting the queue and aborting the print job (if running) | 319 | * @brief Stop the Printer by empting the queue and aborting the print job (if running) | ||
254 | * @sa emergencyStop(),pause(),resume() | 320 | * @sa emergencyStop(),pause(),resume() | ||
255 | */ | 321 | */ | ||
256 | void stop(); | 322 | void stop(); | ||
257 | 323 | | |||
258 | /** | 324 | /** | ||
259 | * @brief stop the printer via the emergency stop Command (M112) | 325 | * @brief stop the printer via the emergency stop Command (M112) | ||
260 | * @sa stop(),pause(),resume() | 326 | * @sa stop(),pause(),resume() | ||
261 | */ | 327 | */ | ||
262 | void emergencyStop(); | 328 | void emergencyStop(); | ||
263 | 329 | | |||
264 | /** | 330 | /** | ||
265 | * @brief pause an in process print job | 331 | * @brief pause an in process print job | ||
266 | * | 332 | * | ||
267 | * Sends M114 on pause to store the location where the head stoped. | 333 | * Sends M114 on pause to store the location where the head stoped. | ||
268 | * This is known to cause problems on fake printers | 334 | * This is known to cause problems on fake printers | ||
335 | * Post Pause moves are not sent for sd card jobs firmware has it own post pause moves | ||||
269 | * @param pauseActions: Gcode to run after pausing commands are ',' separated | 336 | * @param pauseActions: Gcode to run after pausing commands are ',' separated | ||
270 | * @sa resume(),stop(),emergencyStop() | 337 | * @sa resume(),stop(),emergencyStop() | ||
271 | */ | 338 | */ | ||
272 | void pause(const QString &pauseActions); | 339 | void pause(const QString &pauseActions); | ||
273 | 340 | | |||
274 | /** | 341 | /** | ||
275 | * @brief resume a paused print job. | 342 | * @brief resume a paused print job. | ||
276 | * After returning to location pause was triggered. | 343 | * After returning to location pause was triggered. | ||
▲ Show 20 Lines • Show All 96 Lines • ▼ Show 20 Line(s) | |||||
373 | void setUnits(AtCore::UNITS units); | 440 | void setUnits(AtCore::UNITS units); | ||
374 | 441 | | |||
375 | /** | 442 | /** | ||
376 | * @brief Set the time between checks for new serialPorts (0 is default) | 443 | * @brief Set the time between checks for new serialPorts (0 is default) | ||
377 | * @param newTime: Milliseconds between checks. 0 will Disable Checks. | 444 | * @param newTime: Milliseconds between checks. 0 will Disable Checks. | ||
378 | */ | 445 | */ | ||
379 | void setSerialTimerInterval(const quint16 &newTime); | 446 | void setSerialTimerInterval(const quint16 &newTime); | ||
380 | 447 | | |||
448 | /** | ||||
449 | * @brief delete file from sd card | ||||
450 | */ | ||||
451 | void sdDelete(const QString &fileName); | ||||
tcanabrava: why we delete the file from the card? | |||||
rizzitello: Because it is an action that some clients will want to provide to users. There is also a… | |||||
452 | | ||||
381 | private slots: | 453 | private slots: | ||
382 | /** | 454 | /** | ||
383 | * @brief processQueue send commands from the queue. | 455 | * @brief processQueue send commands from the queue. | ||
384 | */ | 456 | */ | ||
385 | void processQueue(); | 457 | void processQueue(); | ||
386 | 458 | | |||
387 | /** | 459 | /** | ||
388 | * @brief Send M105 to the printer if one is not in the Queue | 460 | * @brief Send M105 to the printer if one is not in the Queue | ||
Show All 13 Lines | |||||
402 | */ | 474 | */ | ||
403 | void findFirmware(const QByteArray &message); | 475 | void findFirmware(const QByteArray &message); | ||
404 | 476 | | |||
405 | /** | 477 | /** | ||
406 | * @brief Search for new serial ports | 478 | * @brief Search for new serial ports | ||
407 | */ | 479 | */ | ||
408 | void locateSerialPort(); | 480 | void locateSerialPort(); | ||
409 | 481 | | |||
482 | /** | ||||
483 | * @brief Send request to the printer for the sd card file list. | ||||
484 | */ | ||||
485 | void getSDFileList(); | ||||
486 | | ||||
410 | private: | 487 | private: | ||
411 | /** | 488 | /** | ||
412 | * @brief True if a firmware plugin is loaded | 489 | * @brief True if a firmware plugin is loaded | ||
413 | */ | 490 | */ | ||
414 | bool firmwarePluginLoaded() const; | 491 | bool firmwarePluginLoaded() const; | ||
415 | 492 | | |||
416 | /** | 493 | /** | ||
417 | * @brief True if a serial port is initialized | 494 | * @brief True if a serial port is initialized | ||
Show All 18 Lines |
I'm a bit lost, what is the problem to use it with public functions ?