Twitch SDK (Internal)
channelstatus.h
Go to the documentation of this file.
1 /********************************************************************************************
2 * Twitch Broadcasting SDK
3 *
4 * This software is supplied under the terms of a license agreement with Twitch Interactive, Inc. and
5 * may not be copied or used except in accordance with the terms of that agreement
6 * Copyright (c) 2012-2017 Twitch Interactive, Inc.
7 *********************************************************************************************/
8 
9 #pragma once
10 
13 
14 #include <memory>
15 
16 namespace ttv
17 {
18  class IChannelListener;
19  class ChannelStatus;
20 }
21 
22 
26 class ttv::ChannelStatus : public ttv::PubSubComponent<IChannelListener>, public IChannelStatus
27 {
28 public:
29  using DisposerFunc = std::function<void()>;
30 
31 public:
32  ChannelStatus(const std::shared_ptr<User>& user, ChannelId channelId);
33 
34  // IChannelStatus Implementation
35  virtual TTV_ErrorCode Dispose() override;
36  virtual TTV_ErrorCode UploadProfileImage(const char* imageBuffer, size_t imageSize, const UploadProfileImageCallback& callback) override;
37 
38  virtual TTV_ErrorCode Initialize() override;
39  virtual void Update() override;
40 
41  static std::string GetComponentName() { return "ttv::ChannelStatus"; }
42  virtual std::string GetLoggerName() const override;
43 
44  void OnTopicSubscribeStateChanged(const std::string& topic, PubSubClient::SubscribeState::Enum state, TTV_ErrorCode ec) override;
45  void OnTopicMessageReceived(const std::string& topic, const json::Value& msg) override;
46 
47 protected:
48  // Component overrides
49  virtual bool CheckShutdown() override;
50  virtual void CompleteShutdown() override;
51 
52 private:
53  std::shared_ptr<ComponentContainer> mComponentContainer;
54  std::string mPubSubTopic;
56 };
Definition: ichannelstatus.h:21
ChannelStatus(const std::shared_ptr< User > &user, ChannelId channelId)
ChannelId mChannelId
Definition: channelstatus.h:55
std::function< void()> DisposerFunc
Definition: channelstatus.h:29
virtual std::string GetLoggerName() const override
virtual bool CheckShutdown() override
virtual TTV_ErrorCode Dispose() override
Enum
Definition: pubsubclient.h:91
virtual TTV_ErrorCode Initialize() override
std::function< void(TTV_ErrorCode ec, const std::vector< ProfileImage > &images)> UploadProfileImageCallback
Definition: ichannelstatus.h:24
JSON (JavaScript Object Notation).
Definition: adsapi.h:16
std::string mPubSubTopic
Definition: channelstatus.h:54
virtual TTV_ErrorCode UploadProfileImage(const char *imageBuffer, size_t imageSize, const UploadProfileImageCallback &callback) override
Represents a JSON value.
Definition: value.h:114
static std::string GetComponentName()
Definition: channelstatus.h:41
uint32_t TTV_ErrorCode
Definition: errortypes.h:30
void OnTopicMessageReceived(const std::string &topic, const json::Value &msg) override
void OnTopicSubscribeStateChanged(const std::string &topic, PubSubClient::SubscribeState::Enum state, TTV_ErrorCode ec) override
virtual void Update() override
std::shared_ptr< ComponentContainer > mComponentContainer
Definition: channelstatus.h:53
Definition: channelstatus.h:26
virtual void CompleteShutdown() override
uint32_t ChannelId
Definition: coretypes.h:23
Definition: pubsubcomponent.h:21