Add video stream support
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
#pragma once
|
||||
|
||||
#include "message.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
static const uint8_t STREAM_HOST = 1;
|
||||
static const uint8_t STREAM_INDEX = 0;
|
||||
|
||||
#define STREAM_CTRL_CMD 0xD23F
|
||||
|
||||
#define VIDEO_STREAM_PORT 40921
|
||||
|
||||
enum STREAMSTATE {
|
||||
STREAMSTATE_OFF = 0,
|
||||
STREAMSTATE_ON = 1
|
||||
};
|
||||
|
||||
enum STREAMRESOLUTION {
|
||||
RES_720P = 0,
|
||||
RES_360P = 1,
|
||||
RES_540P = 2
|
||||
};
|
||||
|
||||
enum STREAMCTRL {
|
||||
STREAMCTRL_SDK = 1,
|
||||
STREAMCTRL_VIDEO = 2,
|
||||
STREAMCTRL_AUDIO = 3
|
||||
};
|
||||
|
||||
void
|
||||
stream_ctrl (
|
||||
union Request* req,
|
||||
uint16_t seq,
|
||||
bool ack,
|
||||
enum STREAMSTATE state,
|
||||
enum STREAMRESOLUTION res,
|
||||
enum STREAMCTRL ctrl );
|
||||
|
||||
@@ -263,6 +263,23 @@ struct PACKED BlasterFireResp {
|
||||
struct Footer footer;
|
||||
};
|
||||
|
||||
struct PACKED StreamCtrlReq {
|
||||
struct Header header;
|
||||
uint8_t ctrl;
|
||||
struct {
|
||||
uint8_t state : 4;
|
||||
uint8_t conn_type : 4;
|
||||
};
|
||||
uint8_t resolution;
|
||||
struct Footer footer;
|
||||
};
|
||||
|
||||
struct PACKED StreamCtrlResp {
|
||||
struct Header header;
|
||||
uint8_t retcode;
|
||||
struct Footer footer;
|
||||
};
|
||||
|
||||
union Request {
|
||||
struct Header header;
|
||||
struct SetSdkConnectionReq sdkconn;
|
||||
@@ -277,6 +294,7 @@ union Request {
|
||||
struct SubscribeAddNodeReq subnodeadd;
|
||||
struct GimbalCtrlSpeedReq gimbspeed;
|
||||
struct BlasterFireReq blaster;
|
||||
struct StreamCtrlReq stream;
|
||||
};
|
||||
union Response {
|
||||
struct Header header;
|
||||
@@ -292,6 +310,7 @@ union Response {
|
||||
struct SubscribeAddNodeResp subnodeadd;
|
||||
struct GimbalCtrlSpeedResp gimbspeed;
|
||||
struct BlasterFireResp blaster;
|
||||
struct StreamCtrlResp stream;
|
||||
};
|
||||
union Message {
|
||||
struct Header header;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
// Handle for the high level robot interface
|
||||
struct RobotImp;
|
||||
typedef struct RobotImp* Robot;
|
||||
@@ -67,6 +69,8 @@ int robot_led(Robot, unsigned char r, unsigned char g, unsigned char b);
|
||||
|
||||
int robot_blast(Robot);
|
||||
|
||||
int robot_stream(Robot, bool);
|
||||
|
||||
/*
|
||||
* If the robot is in ready mode, this makes the robot send a heartbeat in
|
||||
* the next tick of the work function. The work function will not do anything
|
||||
|
||||
@@ -9,6 +9,7 @@ typedef struct Client* Client;
|
||||
#include "sdk.h"
|
||||
#include "gimbal.h"
|
||||
#include "blaster.h"
|
||||
#include "camera.h"
|
||||
|
||||
Client client_new();
|
||||
void client_connect(Client client);
|
||||
|
||||
Reference in New Issue
Block a user