SongListDownloader.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #pragma once
  2. #include "device.h"
  3. #include "../xml/obj_xml.h"
  4. #include "XMLString.h"
  5. #include "../Components/wac_downloadManager/DownloadCallbackT.h"
  6. #include "WifiDevice.h"
  7. #include "../xml/ifc_xmlreadercallbackT.h"
  8. #include "main.h"
  9. #include "InfoDownloader.h" // for InfoXML
  10. class WifiXML : public ifc_xmlreadercallbackT<WifiXML>
  11. {
  12. public:
  13. WifiXML(obj_xml *parser);
  14. ~WifiXML();
  15. public:
  16. void xmlReaderOnStartElementCallback(const wchar_t *xmlpath, const wchar_t *xmltag, ifc_xmlreaderparams *params);
  17. void xmlReaderOnEndElementCallback(const wchar_t *xmlpath, const wchar_t *xmltag);
  18. DeviceXML info_xml;
  19. TemplateDevice::PlaylistsList playlists;
  20. TemplateDevice::TrackList tracks;
  21. private:
  22. obj_xml *parser;
  23. TemplateDevice *device;
  24. XMLString artist;
  25. XMLString album;
  26. XMLString composer;
  27. XMLString duration;
  28. XMLString track;
  29. XMLString year;
  30. XMLString size;
  31. XMLString title;
  32. XMLString mime_type;
  33. XMLString modified;
  34. WifiTrack *wifi_track;
  35. WifiPlaylist *wifi_playlist;
  36. };
  37. class SongListDownloader : public DownloadCallbackT<SongListDownloader>
  38. {
  39. public:
  40. SongListDownloader(const char *root_url, WifiDevice *wifi_device);
  41. ~SongListDownloader();
  42. void OnInit(DownloadToken token);
  43. void OnData(DownloadToken token, void *data, size_t datalen);
  44. void OnCancel(DownloadToken token);
  45. void OnError(DownloadToken token, int error);
  46. void OnFinish(DownloadToken token);
  47. private:
  48. obj_xml *parser;
  49. WifiXML *wifi;
  50. TemplateDevice *device;
  51. WifiDevice *wifi_device;
  52. const char *root_url;
  53. };