hurricane/security_camera/common.h

/*******************************************************************************
* # License
* Copyright 2019 Silicon Laboratories Inc. www.silabs.com
*******************************************************************************
*
* The licensor of this software is Silicon Laboratories Inc. Your use of this
* software is governed by the terms of Silicon Labs Master Software License
* Agreement (MSLA) available at
* www.silabs.com/about-us/legal/master-software-license-agreement. This
* software is distributed to you in Source Code format and is governed by the
* sections of the MSLA applicable to Source Code.
*
******************************************************************************/
#pragma once
#include "gos.h"
#include "arducam.h"
#include "hurricane.h"
#define CAMERA_BUFFER_LENGTH (1460*3)
#define IMAGE_WEBHOOK_CODE "IMAGE"
// WARNING: Decreasing this value will exceed the quota for the 'free tier' of Firebase
// Once the quota is exceeded, the device will be throttled for a day.
#define MIN_UPDATE_INTERVAL_MS 60000
#define DEFAULT_UPDATE_INTERNVAL_MS 90000
typedef struct
{
int32_t setting[ARDUCAM_SETTING_MAX];
uint32_t update_interval_ms;
hurricane_gps_antenna_t gps_antenna;
} security_camera_settings_t;
extern security_camera_settings_t* camera_settings;
extern char device_registration_code[5];
gos_result_t camera_init(void);
void camera_set_video_enabled(bool enabled);
bool camera_is_enabled(void);
void camera_broadcast_settings_to_all_clients(void);
void camera_trigger(void *unused);
uint32_t camera_get_ms_until_next_capture(void);
gos_result_t settings_init(void);
gos_result_t settings_save(void);
gos_result_t sensor_init(void);
gos_result_t sensor_set_enabled(bool enabled);
gos_result_t sensor_trigger(void);
gos_result_t sensor_read_all(gos_msgpack_context_t *msgpack);