LightTracker-1.0/libraries/LightTracker_Geofence/LightTrackerGeofence.h

283 wiersze
5.7 KiB
C
Executable File

#ifndef LorawanGeofence_H
#define LorawanGeofence_H
#include "stdint.h"
// GEOFENCE ARRAYS (longitude, latitude)
static float BelarusUkraineF[] = {
28.150636, 56.170601,
23.512829, 53.96112,
22.896858, 47.962315,
33.933407, 44.395214,
38.230714, 47.125474,
40.186306, 49.310392,
33.197192, 52.379758,
28.150636, 56.170601
};
static float KazakhstanF[] = {
46.53603, 48.463995,
52.491606, 42.023431,
58.583072, 45.61293,
80.172921, 42.585565,
87.26915, 49.205074,
75.912764, 54.317144,
61.38909, 54.036592,
60.004246, 50.865411,
50.763895, 51.776407,
46.53603, 48.463995
};
static float IndiaF[] = {
89.109673, 21.528292,
88.011041, 6.415079,
80.032634, 28.872179,
78.718529, 32.65403,
75.36622, 32.273718,
71.903437, 28.032892,
68.197153, 23.757106,
77.449193, 7.884001,
89.109673, 21.528292
};
static float PakistanF[] = {
61.598322, 24.875949,
62.793913, 28.276652,
60.872982, 29.850565,
68.215755, 31.874157,
72.601193, 37.119821,
76.680505, 33.117959,
67.152536, 23.523040,
61.598322, 24.875949
};
static float BangladeshF[] = {
92.300575, 20.981885,
92.146767, 25.145215,
89.850624, 25.403515,
88.394935, 26.611253,
88.010017, 24.674784,
89.131596, 21.659261,
92.300575, 20.981885,
};
static float ArgParUruF[] = {
-57.79910, -18.67750,
-53.48140, -26.66710,
-57.13990, -29.77390,
-49.62520, -34.51560,
-60.24900, -58.56250,
-73.49850, -50.35950,
-67.54390, -21.43260,
-57.79910, -18.67750
};
static float AustraliaF[] = {
147.56840, -46.92030,
166.02540, -29.15220,
144.14060, -9.18890,
98.78910, -11.69530,
112.41210, -39.77480,
147.56840, -46.92030
};
static float BrazilF[] = {
-57.04100, -29.76440,
-49.65820, -34.45220,
-28.30080, -5.87830,
-51.50390, 4.30260,
-60.55660, 5.00340,
-74.17970, -6.49000,
-57.74410, -18.56290,
-53.34960, -26.66710,
-57.04100, -29.76440
};
static float ChinaF[] = {
87.18750, 49.38240,
77.51104, 44.59703,
71.63090, 36.94990,
93.03226, 25.16517,
110.39060, 15.96130,
124.76074, 18.47961,
124.54103, 36.73889,
132.17135, 41.06670,
136.35137, 47.03273,
123.44237, 54.41894,
104.58986, 45.05798,
87.18750, 49.38240
};
static float CostNicPanF[] = {
-88.76950, 11.99630,
-80.20020, 4.80640,
-76.61870, 9.42740,
-82.70510, 15.39010,
-88.76950, 11.99630
};
static float FranceF[] = {
7.95410, 48.76340,
1.91160, 50.94460,
-3.64750, 48.29780,
-1.49410, 43.34120,
2.98830, 42.56930,
7.40480, 43.78700,
5.88870, 46.45300,
7.95410, 48.76340
};
static float JapanF[] = {
138.71337, 49.79545,
130.96153, 38.83591,
124.66191, 34.18805,
124.76075, 24.68693,
144.22850, 23.40280,
156.09372, 49.72447,
138.71337, 49.79545
};
static float LatviaF[] = {
26.64180, 55.68380,
28.17990, 56.20670,
27.78440, 57.33250,
25.00490, 58.00230,
24.14790, 57.17200,
21.78590, 57.68650,
20.81910, 56.07200,
22.19240, 56.44430,
25.68600, 56.18230,
26.64180, 55.68380
};
static float New_ZealandF[] = {
179.99990, -37.78810,
179.99990, -55.22580,
154.33590, -45.82880,
172.26560, -28.76770,
179.99990, -37.78810
};
static float RomaniaF[] = {
27.12520, 47.95310,
22.95040, 47.97520,
20.63230, 45.85940,
23.24710, 43.86620,
29.13570, 43.85040,
27.12520, 47.95310
};
static float North_KoreaF[] = {
130.14189, 4321627,
124.03574, 39.8949,
125.18292, 37.39202,
128.47240, 38.66888,
130.69478, 42.3274,
130.14189, 43.21627
};
static float South_KoreaF[] = {
132.17653, 41.01310,
124.61794, 36.70367,
123.74857, 32.58783,
129.66511, 35.09411,
130.87903, 38.87847,
132.17653, 41.01310
};
static float ThailandF[] = {
110.23679, 15.96138,
93.60347, 24.72692,
94.89994, 6.03131,
104.89745, 6.07500,
110.23679, 15.96138
};
static float UKF[] = {
-0.65920, 60.97310,
-7.58060, 58.07790,
-8.21780, 54.23960,
-4.76810, 53.80070,
-5.86670, 49.76710,
1.30740, 50.85450,
1.86770, 52.78950,
-2.04350, 55.97380,
-0.65920, 60.97310
};
static float VenezuelaF[] = {
-66.65410, 0.18680,
-60.99610, 5.41910,
-59.52390, 9.38400,
-72.15820, 12.49020,
-72.48780, 7.10090,
-67.96140, 5.72530,
-66.65410, 0.18680
};
static float YemenF[] = {
52.20302, 19.48287,
41.92009, 17.42198,
43.59620, 12.27820,
53.68201, 15.80024,
52.20302, 19.48287
};
static float IsraelF[] = {
34.928791, 29.442256,
34.169032, 31.422220,
33.122738, 34.745243,
33.091777, 35.501563,
35.791036, 33.337632,
34.928791, 29.442256
};
static float MongoliaF[] = {
96.416120, 42.739547,
87.843837, 49.160479,
92.330076, 50.874950,
97.229378, 49.747512,
98.921115, 52.139266,
108.518805, 49.322982,
116.705833, 49.846659,
113.628687, 44.748491,
105.007987, 41.592697,
96.416120, 42.739547
};
// VARIABLES
extern uint8_t Lorawan_Geofence_no_tx;
extern uint8_t Lorawan_Geofence_region_code;
extern uint8_t Lorawan_Geofence_special_region_code;
// public region codes - DO NOT CHANGE! used for BasicMAC
enum {
_REGCODE_UNDEF = 0,
_REGCODE_EU868 = 1,
_REGCODE_AS923 = 2,
_REGCODE_US915 = 3,
_REGCODE_AU915 = 4,
_REGCODE_CN470 = 5,
_REGCODE_IN865 = 6,
_REGCODE_RU864 = 101,
_REGCODE_KR920 = 102,
};
// FUNCTIONS
int32_t pointInPolygon(int32_t polyCorners, int32_t * polygon, int32_t latitude, int32_t longitude);
int32_t pointInPolygonF(int32_t polyCorners, float * polygon, float latitude, float longitude);
void Lorawan_Geofence_position(float latitude, float longitude);
#endif