RokuECP 0.1
Control Roku devices remotely with ECP
 
Loading...
Searching...
No Matches
rokuecp.h
1/*
2Copyright 2025 Ben Westover <me@benthetechguy.net>
3
4This program is free software: you can redistribute it and/or modify it under
5the terms of the GNU General Public License as published by the Free Software
6Foundation, either version 3 of the License, or (at your option) any later version.
7
8This program is distributed in the hope that it will be useful, but WITHOUT ANY
9WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
10PARTICULAR PURPOSE. See the GNU General Public License for more details.
11
12You should have received a copy of the GNU General Public License along with
13this program. If not, see <https://www.gnu.org/licenses/>.
14*/
15
16#ifndef ROKUECP_H
17#define ROKUECP_H
18
19#ifdef __cplusplus
21namespace rokuecp {
22 extern "C" {
23#else
24#include <wchar.h>
25#include <stdbool.h>
26#endif
28 typedef struct {
29 char name[122];
30 char location[16];
31 char url[30];
32 char model[32];
33 char serial[14];
34 bool isTV;
35 bool isOn;
40 char resolution[8];
41 char macAddress[18];
42 char softwareVersion[10];
43 } RokuDevice;
44
46 typedef struct {
47 char id[8];
48 char name[8];
49 char type[14];
50 bool isHidden;
52 unsigned short int physicalChannel;
53 unsigned long int frequency;
55
57 typedef struct {
58 char title[112];
59 char description[256];
60 char rating[15];
61 bool hasCC;
63
68 typedef struct {
75
78 char resolution[8];
79 unsigned short int signalQuality;
80 signed short int signalStrength;
82
84 typedef struct {
85 char id[14];
86 char name[31];
87 char type[5];
88 char version[22];
89 } RokuApp;
90
92 typedef struct {
93 const unsigned char* data;
94 unsigned long long int size;
96
98 typedef enum {
99 MOVIE,
100 SHOW,
101 PERSON,
102 APP,
103 GAME,
104 NONE
106
108 typedef struct {
111 char tmsID[15];
112 unsigned short int season;
115 char providerIDs[14][8];
117
125 int findRokuDevices(int maxDevices, char* deviceList[]);
126
132 RokuDevice getRokuDevice(const char* url);
133
141 int rokuSendKey(const RokuDevice *device, const char* key);
142
153 int getRokuTVChannels(const RokuDevice *device, int maxChannels, RokuTVChannel channelList[]);
154
161
169 int getRokuApps(const RokuDevice *device, int maxApps, RokuApp appList[]);
170
176 RokuApp getActiveRokuApp(const RokuDevice *device);
177
184 RokuAppIcon getRokuAppIcon(const RokuDevice *device, const RokuApp *app);
185
194 int sendCustomRokuInput(const RokuDevice *device, int params, const char* names[], const char* values[]);
195
203 int rokuSearch(const RokuDevice *device, const char* keyword, const RokuSearchParams *params);
204
211 int rokuTypeString(const RokuDevice *device, const wchar_t* string);
212#ifdef __cplusplus
213 } // extern "C"
214} //namespace rokuecp
215#endif
216
217#endif //ROKUECP_H
RokuECP namespace.
Definition: rokuecp.h:21
int rokuSendKey(const RokuDevice *device, const char *key)
Send a keypress to a Roku Device, emulating the press of a button on a Roku Remote.
Definition: rokuecp.cpp:219
int rokuTypeString(const RokuDevice *device, const wchar_t *string)
Send Unicode string to Roku device as a series of keyboard keypresses.
Definition: rokuecp.cpp:567
RokuExtTVChannel getActiveRokuTVChannel(const RokuDevice *device)
Get either the current or last active TV channel on a given Roku device.
Definition: rokuecp.cpp:296
int findRokuDevices(int maxDevices, char *deviceList[])
Find Roku devices on the network using SSDP.
Definition: rokuecp.cpp:133
RokuDevice getRokuDevice(const char *url)
Get information about a Roku Device from its ECP URL.
Definition: rokuecp.cpp:173
int getRokuTVChannels(const RokuDevice *device, int maxChannels, RokuTVChannel channelList[])
Get a list of TV channels accessible from a given Roku device.
Definition: rokuecp.cpp:236
int rokuSearch(const RokuDevice *device, const char *keyword, const RokuSearchParams *params)
Run search for a movie, TV show, person, or app.
Definition: rokuecp.cpp:505
RokuSearchType
enum Roku search filter (movie, TV show, person, app, game, or none)
Definition: rokuecp.h:98
RokuApp getActiveRokuApp(const RokuDevice *device)
Get the current active app on a given Roku device.
Definition: rokuecp.cpp:432
int getRokuApps(const RokuDevice *device, int maxApps, RokuApp appList[])
Get a list of apps on a given Roku device.
Definition: rokuecp.cpp:381
int sendCustomRokuInput(const RokuDevice *device, int params, const char *names[], const char *values[])
Send custom input to the currently active app on a given Roku device.
Definition: rokuecp.cpp:486
RokuAppIcon getRokuAppIcon(const RokuDevice *device, const RokuApp *app)
Get a given app's icon.
Definition: rokuecp.cpp:474
Object containing a Roku channel (app) icon.
Definition: rokuecp.h:92
const unsigned char * data
pointer to a series of bytes (unsigned char) with the icon data
Definition: rokuecp.h:93
unsigned long long int size
64-bit integer number of bytes pointed to by the data attribute
Definition: rokuecp.h:94
Object containing information about a Roku channel (app)
Definition: rokuecp.h:84
Object containing information about a Roku Device.
Definition: rokuecp.h:28
bool hasSearchSupport
bool which is true if the device has search support
Definition: rokuecp.h:37
bool developerMode
bool which is true if the device has developer mode enabled
Definition: rokuecp.h:36
bool isTV
bool which is true if the device is a Roku TV
Definition: rokuecp.h:34
bool isOn
bool which is true if the device is currently powered on
Definition: rokuecp.h:35
bool headphonesConnected
bool which is true if the device is currently in Private Listening mode
Definition: rokuecp.h:39
bool hasHeadphoneSupport
bool which is true if the device supports Private Listening
Definition: rokuecp.h:38
Object containing extended information about a TV channel.
Definition: rokuecp.h:68
bool signalReceived
bool which is false if there is currently no signal
Definition: rokuecp.h:77
bool isActive
bool which is true if the channel is currently playing on the TV.
Definition: rokuecp.h:74
RokuTVChannel channel
RokuTVChannel object representing the channel.
Definition: rokuecp.h:69
RokuTVProgram program
RokuTVProgram object representing the currently playing program.
Definition: rokuecp.h:76
unsigned short int signalQuality
integer signal quality level from 0-100
Definition: rokuecp.h:79
signed short int signalStrength
signed integer signal strength in dB
Definition: rokuecp.h:80
Object containing information about a Roku search to be performed.
Definition: rokuecp.h:108
RokuSearchType type
enum Roku search filter
Definition: rokuecp.h:109
unsigned short int season
integer season of the show to search for
Definition: rokuecp.h:112
bool includeUnavailable
bool which is true if results that are unavailable in your region should still be included
Definition: rokuecp.h:110
bool autoSelect
bool which is true if the first result should automatically be selected
Definition: rokuecp.h:113
bool autoLaunch
bool which is true if the first provider in providerIDs with a result found should be launched automa...
Definition: rokuecp.h:114
Object containing information about a TV channel on a Roku device.
Definition: rokuecp.h:46
unsigned long int frequency
integer channel frequency in Hz (6-8 million)
Definition: rokuecp.h:53
unsigned short int physicalChannel
integer physical RF channel number (2-69)
Definition: rokuecp.h:52
bool isFavorite
bool which is true if the channel is on the user's favorite list
Definition: rokuecp.h:51
bool isHidden
bool which is true if the channel was hidden by the user
Definition: rokuecp.h:50
Object containing information about a TV program on a Roku device.
Definition: rokuecp.h:57
bool hasCC
bool which is true if the program has closed captions available
Definition: rokuecp.h:61