Furi Region Mocks, fix protocol dict funcs was disabled in API

This commit is contained in:
MX 2022-11-10 10:45:51 +03:00
parent af40b6b020
commit b93f2dc293
No known key found for this signature in database
GPG key ID: 6C4C311DFD4B4AB5
3 changed files with 112 additions and 15 deletions

View file

@ -1,5 +1,5 @@
entry,status,name,type,params
Version,+,7.31,,
Version,+,7.32,,
Header,+,applications/services/bt/bt_service/bt.h,,
Header,+,applications/services/cli/cli.h,,
Header,+,applications/services/cli/cli_vcp.h,,
@ -1239,8 +1239,12 @@ Function,+,furi_hal_pwm_start,void,"FuriHalPwmOutputId, uint32_t, uint8_t"
Function,+,furi_hal_pwm_stop,void,FuriHalPwmOutputId
Function,+,furi_hal_random_fill_buf,void,"uint8_t*, uint32_t"
Function,+,furi_hal_random_get,uint32_t,
Function,+,furi_hal_region_get,const FuriHalRegion*,
Function,+,furi_hal_region_get_band,const FuriHalRegionBand*,uint32_t
Function,+,furi_hal_region_get_name,const char*,
Function,+,furi_hal_region_is_frequency_allowed,_Bool,uint32_t
Function,+,furi_hal_region_is_provisioned,_Bool,
Function,+,furi_hal_region_set,void,FuriHalRegion*
Function,+,furi_hal_resources_deinit_early,void,
Function,-,furi_hal_resources_init,void,
Function,-,furi_hal_resources_init_early,void,
@ -2051,22 +2055,22 @@ Function,-,powl,long double,"long double, long double"
Function,-,printf,int,"const char*, ..."
Function,-,prng_successor,uint32_t,"uint32_t, uint32_t"
Function,+,protocol_dict_alloc,ProtocolDict*,"const ProtocolBase**, size_t"
Function,-,protocol_dict_decoders_feed,ProtocolId,"ProtocolDict*, _Bool, uint32_t"
Function,-,protocol_dict_decoders_feed_by_feature,ProtocolId,"ProtocolDict*, uint32_t, _Bool, uint32_t"
Function,-,protocol_dict_decoders_feed_by_id,ProtocolId,"ProtocolDict*, size_t, _Bool, uint32_t"
Function,-,protocol_dict_decoders_start,void,ProtocolDict*
Function,-,protocol_dict_encoder_start,_Bool,"ProtocolDict*, size_t"
Function,-,protocol_dict_encoder_yield,LevelDuration,"ProtocolDict*, size_t"
Function,+,protocol_dict_decoders_feed,ProtocolId,"ProtocolDict*, _Bool, uint32_t"
Function,+,protocol_dict_decoders_feed_by_feature,ProtocolId,"ProtocolDict*, uint32_t, _Bool, uint32_t"
Function,+,protocol_dict_decoders_feed_by_id,ProtocolId,"ProtocolDict*, size_t, _Bool, uint32_t"
Function,+,protocol_dict_decoders_start,void,ProtocolDict*
Function,+,protocol_dict_encoder_start,_Bool,"ProtocolDict*, size_t"
Function,+,protocol_dict_encoder_yield,LevelDuration,"ProtocolDict*, size_t"
Function,+,protocol_dict_free,void,ProtocolDict*
Function,-,protocol_dict_get_data,void,"ProtocolDict*, size_t, uint8_t*, size_t"
Function,-,protocol_dict_get_data_size,size_t,"ProtocolDict*, size_t"
Function,-,protocol_dict_get_features,uint32_t,"ProtocolDict*, size_t"
Function,-,protocol_dict_get_manufacturer,const char*,"ProtocolDict*, size_t"
Function,-,protocol_dict_get_max_data_size,size_t,ProtocolDict*
Function,-,protocol_dict_get_name,const char*,"ProtocolDict*, size_t"
Function,+,protocol_dict_get_data,void,"ProtocolDict*, size_t, uint8_t*, size_t"
Function,+,protocol_dict_get_data_size,size_t,"ProtocolDict*, size_t"
Function,+,protocol_dict_get_features,uint32_t,"ProtocolDict*, size_t"
Function,+,protocol_dict_get_manufacturer,const char*,"ProtocolDict*, size_t"
Function,+,protocol_dict_get_max_data_size,size_t,ProtocolDict*
Function,+,protocol_dict_get_name,const char*,"ProtocolDict*, size_t"
Function,+,protocol_dict_get_protocol_by_name,ProtocolId,"ProtocolDict*, const char*"
Function,-,protocol_dict_get_validate_count,uint32_t,"ProtocolDict*, size_t"
Function,-,protocol_dict_get_write_data,_Bool,"ProtocolDict*, size_t, void*"
Function,+,protocol_dict_get_validate_count,uint32_t,"ProtocolDict*, size_t"
Function,+,protocol_dict_get_write_data,_Bool,"ProtocolDict*, size_t, void*"
Function,+,protocol_dict_render_brief_data,void,"ProtocolDict*, FuriString*, size_t"
Function,+,protocol_dict_render_data,void,"ProtocolDict*, FuriString*, size_t"
Function,+,protocol_dict_set_data,void,"ProtocolDict*, size_t, const uint8_t*, size_t"

1 entry status name type params
2 Version + 7.31 7.32
3 Header + applications/services/bt/bt_service/bt.h
4 Header + applications/services/cli/cli.h
5 Header + applications/services/cli/cli_vcp.h
1239 Function + furi_hal_pwm_stop void FuriHalPwmOutputId
1240 Function + furi_hal_random_fill_buf void uint8_t*, uint32_t
1241 Function + furi_hal_random_get uint32_t
1242 Function + furi_hal_region_get const FuriHalRegion*
1243 Function + furi_hal_region_get_band const FuriHalRegionBand* uint32_t
1244 Function + furi_hal_region_get_name const char*
1245 Function + furi_hal_region_is_frequency_allowed _Bool uint32_t
1246 Function + furi_hal_region_is_provisioned _Bool
1247 Function + furi_hal_region_set void FuriHalRegion*
1248 Function + furi_hal_resources_deinit_early void
1249 Function - furi_hal_resources_init void
1250 Function - furi_hal_resources_init_early void
2055 Function - printf int const char*, ...
2056 Function - prng_successor uint32_t uint32_t, uint32_t
2057 Function + protocol_dict_alloc ProtocolDict* const ProtocolBase**, size_t
2058 Function - + protocol_dict_decoders_feed ProtocolId ProtocolDict*, _Bool, uint32_t
2059 Function - + protocol_dict_decoders_feed_by_feature ProtocolId ProtocolDict*, uint32_t, _Bool, uint32_t
2060 Function - + protocol_dict_decoders_feed_by_id ProtocolId ProtocolDict*, size_t, _Bool, uint32_t
2061 Function - + protocol_dict_decoders_start void ProtocolDict*
2062 Function - + protocol_dict_encoder_start _Bool ProtocolDict*, size_t
2063 Function - + protocol_dict_encoder_yield LevelDuration ProtocolDict*, size_t
2064 Function + protocol_dict_free void ProtocolDict*
2065 Function - + protocol_dict_get_data void ProtocolDict*, size_t, uint8_t*, size_t
2066 Function - + protocol_dict_get_data_size size_t ProtocolDict*, size_t
2067 Function - + protocol_dict_get_features uint32_t ProtocolDict*, size_t
2068 Function - + protocol_dict_get_manufacturer const char* ProtocolDict*, size_t
2069 Function - + protocol_dict_get_max_data_size size_t ProtocolDict*
2070 Function - + protocol_dict_get_name const char* ProtocolDict*, size_t
2071 Function + protocol_dict_get_protocol_by_name ProtocolId ProtocolDict*, const char*
2072 Function - + protocol_dict_get_validate_count uint32_t ProtocolDict*, size_t
2073 Function - + protocol_dict_get_write_data _Bool ProtocolDict*, size_t, void*
2074 Function + protocol_dict_render_brief_data void ProtocolDict*, FuriString*, size_t
2075 Function + protocol_dict_render_data void ProtocolDict*, FuriString*, size_t
2076 Function + protocol_dict_set_data void ProtocolDict*, size_t, const uint8_t*, size_t

View file

@ -1,4 +1,48 @@
#include <furi_hal_region.h>
#include <furi.h>
const FuriHalRegion furi_hal_region_zero = {
.country_code = "00",
.bands_count = 1,
.bands = {
{
.start = 0,
.end = 1000000000,
.power_limit = 12,
.duty_cycle = 50,
},
}};
static const FuriHalRegion* furi_hal_region = NULL;
const FuriHalRegion* furi_hal_region_get() {
return &furi_hal_region_zero;
}
void furi_hal_region_set(FuriHalRegion* region) {
UNUSED(region);
}
const FuriHalRegionBand* furi_hal_region_get_band(uint32_t frequency) {
furi_hal_region = &furi_hal_region_zero;
if(!furi_hal_region) {
return NULL;
}
for(size_t i = 0; i < furi_hal_region->bands_count; i++) {
if(furi_hal_region->bands[i].start <= frequency &&
furi_hal_region->bands[i].end >= frequency) {
return &furi_hal_region->bands[i];
}
}
return NULL;
}
bool furi_hal_region_is_frequency_allowed(uint32_t frequency) {
UNUSED(frequency);
return true;
}
bool furi_hal_region_is_provisioned() {
return true;

View file

@ -2,10 +2,40 @@
#include <stdbool.h>
#include <stdint.h>
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
uint32_t start;
uint32_t end;
int8_t power_limit;
uint8_t duty_cycle;
} FuriHalRegionBand;
typedef struct {
char country_code[4];
uint16_t bands_count;
FuriHalRegionBand bands[];
} FuriHalRegion;
/** Get Region Data.
*
* Region data may be allocated in Flash or in RAM.
* Keep in mind that we don't do memory management on our side.
*
* @return pointer to FuriHalRegion instance (in RAM or Flash, check before freeing on region update)
*/
const FuriHalRegion* furi_hal_region_get();
/** Set device region data
*
* @param region pointer to the FuriHalRegion
*/
void furi_hal_region_set(FuriHalRegion* region);
/** Check if region data provisioned
*
* @return true if provisioned, false otherwise
@ -26,6 +56,25 @@ bool furi_hal_region_is_provisioned();
*/
const char* furi_hal_region_get_name();
/** Сheck if transmission is allowed on this frequency for your flipper region
*
* @param[in] frequency The frequency
* @param value frequency in Hz
*
* @return true if allowed
*/
bool furi_hal_region_is_frequency_allowed(uint32_t frequency);
/** Get band data for frequency
*
*
*
* @param[in] frequency The frequency
*
* @return { description_of_the_return_value }
*/
const FuriHalRegionBand* furi_hal_region_get_band(uint32_t frequency);
#ifdef __cplusplus
}
#endif