145 lines
3.0 KiB
C
145 lines
3.0 KiB
C
#ifndef E_COMMON_H
|
|
#define E_COMMON_H
|
|
|
|
#include <stdbool.h>
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
#include "../lvgl/lvgl.h"
|
|
#include "version.h"
|
|
|
|
#define MAX_ID_LEN 64
|
|
#define MAX_URL_LEN 512
|
|
#define MAX_NAME_LEN 128
|
|
#define MAX_MD5_LEN 64
|
|
#define MAX_DEVICE_ID 64
|
|
#define MAX_PLAYLIST 64
|
|
|
|
// 最大键和值的长度
|
|
#define MAX_KEY_LEN 64
|
|
#define MAX_VALUE_LEN 256
|
|
|
|
// 最大价格图数量
|
|
#define MAX_PRICE_IMAGES 10
|
|
|
|
#if PROTOCOL_VERSION == 0
|
|
#define MEDIA_TYPE_VIDEO 1 // 视频
|
|
#define MEDIA_TYPE_IMAGE 0 // 图片
|
|
#define MEDIA_TYPE_ADV_IMAGE 3 // 广告图片
|
|
#define MEDIA_TYPE_APP 9 // 应用
|
|
#define MEDIA_TYPE_FIRMWARE 10 // 固件
|
|
|
|
#define PLAYER_LIST_GROUP_TYPE_BG 0 // 背景图
|
|
#define PLAYER_LIST_GROUP_TYPE_PRICE 1 // 价格图
|
|
#endif
|
|
|
|
#if PROTOCOL_VERSION == 1
|
|
#define MEDIA_TYPE_VIDEO 2 // 视频
|
|
#define MEDIA_TYPE_IMAGE 1 // 图片
|
|
#define MEDIA_TYPE_APP 9 // 应用
|
|
#define MEDIA_TYPE_FIRMWARE 10 // 固件
|
|
|
|
#define PLAYER_LIST_GROUP_TYPE_BG 1 // 背景图
|
|
#define PLAYER_LIST_GROUP_TYPE_PRICE 3 // 价格图
|
|
#define MEDIA_TYPE_ADV_IMAGE 3 // 广告图片
|
|
#endif
|
|
|
|
#define DEFAULT_USERNAME "LCD"
|
|
#define DEFAULT_PASSWORD "eTagTech@Pass"
|
|
|
|
// 检查字符串是否为NULL或空字符串
|
|
#define IS_EMPTY_OR_NULL(str) (!(str) || (str)[0] == '\0')
|
|
|
|
|
|
typedef struct
|
|
{
|
|
/* data */
|
|
int32_t x;
|
|
int32_t y;
|
|
int32_t width;
|
|
int32_t height;
|
|
} e_player_area;
|
|
|
|
typedef struct
|
|
{
|
|
char deviceId[MAX_DEVICE_ID];
|
|
char downloadUrl[MAX_URL_LEN];
|
|
char item_id[MAX_ID_LEN];
|
|
char file_name[MAX_NAME_LEN];
|
|
int type;// 0 image 1 video
|
|
|
|
char path[MAX_URL_LEN];
|
|
|
|
} MediaPath;
|
|
|
|
typedef struct
|
|
{
|
|
char id[MAX_ID_LEN];
|
|
char confirm_url[MAX_URL_LEN];
|
|
char download_url[MAX_URL_LEN];
|
|
char file_name[MAX_NAME_LEN];
|
|
int group;
|
|
int index;
|
|
int left;
|
|
int top;
|
|
int type; // 0 image 1 video
|
|
int width;
|
|
int height;
|
|
char MD5[MAX_MD5_LEN];
|
|
int64_t size;
|
|
char device_id[MAX_DEVICE_ID];
|
|
// bool sync_play;
|
|
int play_time;
|
|
int display_idx;//屏幕索引
|
|
|
|
char new_name[MAX_NAME_LEN];
|
|
} MediaItem;
|
|
|
|
typedef struct
|
|
{
|
|
char device[MAX_DEVICE_ID];
|
|
char taskId[MAX_ID_LEN];
|
|
int taskCode;
|
|
MediaItem list[MAX_PLAYLIST];
|
|
int list_size;
|
|
} PlayList;
|
|
|
|
typedef struct
|
|
{
|
|
int lv_obj_type; // 0 背景图 1 价格图
|
|
int target_display;
|
|
e_player_area *area;
|
|
char *lvgl_path;
|
|
int play_time;//播放时间,单位毫秒
|
|
} lv_sync_image_update_src;
|
|
|
|
typedef struct
|
|
{
|
|
int target_display;
|
|
char *lvgl_path;
|
|
} lv_display_image_src;
|
|
|
|
|
|
typedef enum
|
|
{
|
|
NETWORK_DISCONNECT, // 网络断开
|
|
NETWORK_CONNECTED, // 网络连接
|
|
MQTT_DISCONNECT, // MQTT断开
|
|
MQTT_CONNECTED // MQTT连接
|
|
} e_player_status;
|
|
|
|
typedef struct
|
|
{
|
|
e_player_status status;
|
|
int target_display;
|
|
long long last_task_time;
|
|
} e_sync_update_status_bar;
|
|
|
|
// 配置项结构
|
|
typedef struct
|
|
{
|
|
char key[MAX_KEY_LEN];
|
|
char value[MAX_VALUE_LEN];
|
|
} ConfigItem;
|
|
|
|
|
|
#endif // E_COMMON_H
|