123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- #pragma once
- #include <NanoPBHelper.h>
- #include <memory>
- #include <string>
- #include <vector>
- #include "CSpotContext.h"
- #include "ConstantParameters.h"
- #include "CspotAssert.h"
- #include "TimeProvider.h"
- #include "Utils.h"
- #include "protobuf/spirc.pb.h"
- namespace cspot {
- class PlaybackState {
- private:
- std::shared_ptr<cspot::Context> ctx;
- uint32_t seqNum = 0;
- uint8_t capabilityIndex = 0;
- std::vector<uint8_t> frameData;
- void addCapability(
- CapabilityType typ, int intValue = -1,
- std::vector<std::string> stringsValue = std::vector<std::string>());
- public:
- Frame innerFrame;
- Frame remoteFrame;
- enum class State { Playing, Stopped, Loading, Paused };
-
- PlaybackState(std::shared_ptr<cspot::Context> ctx);
- ~PlaybackState();
-
- void setPlaybackState(const PlaybackState::State state);
-
- void setActive(bool isActive);
-
- bool isActive();
-
- void updatePositionMs(uint32_t position);
-
- void setVolume(uint32_t volume);
-
- void setShuffle(bool shuffle);
-
- void setRepeat(bool repeat);
-
- void updateTracks();
-
- bool nextTrack();
-
- void prevTrack();
-
- TrackRef* getCurrentTrackRef();
-
- TrackRef* getNextTrackRef();
-
- std::vector<uint8_t> encodeCurrentFrame(MessageType typ);
- };
- }
|