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(uint 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(uint 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 Append a file to AtCorePrivate::sdCardFileList. | ||||
225 | * @param fileName: new FileName | ||||
226 | */ | ||||
227 | void appendSdCardFileList(const QString &fileName); | ||||
228 | | ||||
229 | /** | ||||
230 | * @brief Clear AtCorePrivate::sdCardFileList. | ||||
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() const; | ||||
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 returns AtCorePrivate::sdCardReadingFileList | ||||
248 | * @return True if printer is returning sd card file list | ||||
249 | */ | ||||
250 | bool isReadingSdCardList() const; | ||||
tcanabrava: bool isReadingSdCardList() const; | |||||
251 | | ||||
252 | /** | ||||
253 | * @brief set AtCorePrivate::sdCardReadingFileList | ||||
254 | * @param readingList set 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 &portList); | ||
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 | /** | ||
▲ Show 20 Lines • Show All 114 Lines • ▼ Show 20 Line(s) | |||||
373 | void setUnits(AtCore::UNITS units); | 439 | void setUnits(AtCore::UNITS units); | ||
374 | 440 | | |||
375 | /** | 441 | /** | ||
376 | * @brief Set the time between checks for new serialPorts (0 is default) | 442 | * @brief Set the time between checks for new serialPorts (0 is default) | ||
377 | * @param newTime: Milliseconds between checks. 0 will Disable Checks. | 443 | * @param newTime: Milliseconds between checks. 0 will Disable Checks. | ||
378 | */ | 444 | */ | ||
379 | void setSerialTimerInterval(const quint16 &newTime); | 445 | void setSerialTimerInterval(const quint16 &newTime); | ||
380 | 446 | | |||
447 | /** | ||||
448 | * @brief delete file from sd card | ||||
449 | */ | ||||
450 | 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… | |||||
451 | | ||||
452 | /** | ||||
453 | * @brief Queue the Printer for status of sd card print | ||||
454 | */ | ||||
455 | void sdCardPrintStatus(); | ||||
456 | | ||||
381 | private slots: | 457 | private slots: | ||
382 | /** | 458 | /** | ||
383 | * @brief processQueue send commands from the queue. | 459 | * @brief processQueue send commands from the queue. | ||
384 | */ | 460 | */ | ||
385 | void processQueue(); | 461 | void processQueue(); | ||
386 | 462 | | |||
387 | /** | 463 | /** | ||
388 | * @brief Send M105 to the printer if one is not in the Queue | 464 | * @brief Send M105 to the printer if one is not in the Queue | ||
Show All 13 Lines | |||||
402 | */ | 478 | */ | ||
403 | void findFirmware(const QByteArray &message); | 479 | void findFirmware(const QByteArray &message); | ||
404 | 480 | | |||
405 | /** | 481 | /** | ||
406 | * @brief Search for new serial ports | 482 | * @brief Search for new serial ports | ||
407 | */ | 483 | */ | ||
408 | void locateSerialPort(); | 484 | void locateSerialPort(); | ||
409 | 485 | | |||
486 | /** | ||||
487 | * @brief Send request to the printer for the sd card file list. | ||||
488 | */ | ||||
489 | void getSDFileList(); | ||||
490 | | ||||
410 | private: | 491 | private: | ||
411 | /** | 492 | /** | ||
412 | * @brief True if a firmware plugin is loaded | 493 | * @brief True if a firmware plugin is loaded | ||
413 | */ | 494 | */ | ||
414 | bool firmwarePluginLoaded() const; | 495 | bool firmwarePluginLoaded() const; | ||
415 | 496 | | |||
416 | /** | 497 | /** | ||
417 | * @brief True if a serial port is initialized | 498 | * @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 ?