Skip to content

Commit 3d9c123

Browse files
Cameron MorrowCameron Morrow
Cameron Morrow
authored and
Cameron Morrow
committedAug 8, 2021
adding initial SDK API
1 parent fdafb40 commit 3d9c123

File tree

5 files changed

+294
-1
lines changed

5 files changed

+294
-1
lines changed
 

‎.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.DS_Store
2+
13
## Ignore Visual Studio temporary files, build results, and
24
## files generated by popular Visual Studio add-ons.
35
##
@@ -360,4 +362,4 @@ MigrationBackup/
360362
.ionide/
361363

362364
# Fody - auto-generated XML schema
363-
FodyWeavers.xsd
365+
FodyWeavers.xsd

‎Library/RadarIO.Xamarin/Radar.cs

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using System;
2+
3+
namespace RadarIO.Xamarin
4+
{
5+
public static class Radar
6+
{
7+
private static Lazy<RadarSDK> instance
8+
= new Lazy<RadarSDK>(() => CreateInstance(), System.Threading.LazyThreadSafetyMode.PublicationOnly);
9+
10+
private static RadarSDK CreateInstance()
11+
{
12+
#if LIBRARY
13+
return null;
14+
#else
15+
return new RadarSDKImpl();
16+
#endif
17+
}
18+
}
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netstandard2.0</TargetFramework>
5+
</PropertyGroup>
6+
7+
<PropertyGroup>
8+
<DefineConstants>LIBRARY</DefineConstants>
9+
</PropertyGroup>
10+
11+
</Project>

‎Library/RadarIO.Xamarin/RadarSDK.cs

+244
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,244 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Text;
4+
using System.Threading.Tasks;
5+
6+
namespace RadarIO.Xamarin
7+
{
8+
public abstract class RadarSDK
9+
{
10+
public abstract Task<(RadarStatus, RadarLocation, RadarEvent[], RadarUser)> TrackOnce();
11+
}
12+
13+
public class RadarUser
14+
{
15+
public string Id;
16+
public string UserId;
17+
public string DeviceId;
18+
public string Description;
19+
public JSONObject Metadata;
20+
public RadarLocation Location;
21+
public IEnumerable<RadarGeofence> Geofences;
22+
public RadarPlace Place;
23+
public RadarUserInsights Insights;
24+
public IEnumerable<RadarBeacon> Beacons;
25+
public bool Stopped;
26+
public bool Foreground;
27+
public RadarRegion Country;
28+
public RadarRegion State;
29+
public RadarRegion DMA;
30+
public RadarRegion PostalCode;
31+
public IEnumerable<RadarChain> NearbyPlaceChains;
32+
public IEnumerable<RadarSegment> Segments;
33+
public IEnumerable<RadarChain> TopChains;
34+
public RadarLocationSource Source;
35+
public bool Proxy;
36+
public RadarTrip Trip;
37+
}
38+
39+
public class RadarTrip
40+
{
41+
public string Id;
42+
public string ExternalId;
43+
public JSONObject Metadata;
44+
public string DestinationGeofenceTag;
45+
public string DestinationGeofenceExternalId;
46+
public RadarCoordinate DestinationLocation;
47+
public RadarRouteMode Mode;
48+
public double EtaDistance;
49+
public double EtaDuration;
50+
public RadarTripStatus Status;
51+
}
52+
53+
public enum RadarTripStatus
54+
{
55+
Canceled,
56+
Completed,
57+
Expired,
58+
Arrived,
59+
Approaching,
60+
Started,
61+
Unknown
62+
}
63+
64+
public enum RadarRouteMode
65+
{
66+
Motorbike,
67+
Truck,
68+
Car,
69+
Bike,
70+
Foot
71+
}
72+
73+
public enum RadarLocationSource
74+
{
75+
Unknown,
76+
BeaconExit,
77+
BeaconEnter,
78+
MockLocation,
79+
GeofenceExit,
80+
GeofenceDwell,
81+
GeofenceEnter,
82+
ManualLocation,
83+
BackgroundLocation,
84+
ForegroundLocation
85+
}
86+
87+
public class RadarSegment
88+
{
89+
public string Description;
90+
public string ExternalId;
91+
}
92+
93+
public class RadarChain
94+
{
95+
public string Slug;
96+
public string Name;
97+
public string ExternalId;
98+
public JSONObject Metadata;
99+
}
100+
101+
102+
public class RadarRegion
103+
{
104+
public string Id;
105+
public string Name;
106+
public string Code;
107+
public string Type;
108+
public string Flag;
109+
}
110+
111+
public class RadarBeacon
112+
{
113+
public string Id;
114+
public string Description;
115+
public string Tag;
116+
public string ExternalId;
117+
public string UUID;
118+
public string Major;
119+
public string Minor;
120+
public JSONObject Metadata;
121+
public RadarLocation Location;
122+
}
123+
124+
public class RadarUserInsights
125+
{
126+
public RadarUserInsightsLocation HomeLocation;
127+
public RadarUserInsightsLocation OfficeLocation;
128+
public RadarUserInsightsState State;
129+
}
130+
131+
public class RadarUserInsightsState
132+
{
133+
public bool Home;
134+
public bool Office;
135+
public bool Traveling;
136+
public bool Commuting;
137+
}
138+
139+
public class RadarUserInsightsLocation
140+
{
141+
public RadarUserInsightsLocationType Type;
142+
public RadarCoordinate Location;
143+
public RadarUserInsightsLocationConfidence Confidence;
144+
public DateTime? UpdatedAt;
145+
public RadarRegion Country;
146+
public RadarRegion State;
147+
public RadarRegion DMA;
148+
public RadarRegion PostalCode;
149+
}
150+
151+
public enum RadarUserInsightsLocationConfidence
152+
{
153+
High,
154+
Medium,
155+
Low,
156+
None
157+
}
158+
159+
public enum RadarUserInsightsLocationType
160+
{
161+
Office,
162+
Home,
163+
Unknown
164+
}
165+
166+
public class RadarPlace
167+
{
168+
public string Id;
169+
public string Name;
170+
public IEnumerable<string> Categories;
171+
public RadarChain Chain;
172+
public RadarLocation Location;
173+
public string Group;
174+
public JSONObject Metadata;
175+
}
176+
177+
public class RadarGeofence
178+
{
179+
public string Id;
180+
public string Description;
181+
public string Tag;
182+
public string ExternalId;
183+
public JSONObject Metadata;
184+
public RadarGeofenceGeometry Geometry;
185+
}
186+
187+
public abstract class RadarGeofenceGeometry { }
188+
189+
public class RadarCircleGeometry : RadarGeofenceGeometry
190+
{
191+
public RadarCoordinate Center;
192+
public double Radius;
193+
}
194+
195+
public class RadarPolygonGeometry : RadarGeofenceGeometry
196+
{
197+
public RadarCoordinate Center;
198+
public IEnumerable<RadarCoordinate> Coordinates;
199+
public double Radius;
200+
}
201+
202+
public class RadarCoordinate
203+
{
204+
public double Latitude;
205+
public double Longitude;
206+
}
207+
208+
public class RadarEvent
209+
{
210+
211+
}
212+
213+
public class RadarLocation
214+
{
215+
public double Longitude;
216+
public double Latitude;
217+
public float Bearing;
218+
public double Altitude;
219+
public float Speed;
220+
public DateTime? Timestamp;
221+
// todo
222+
}
223+
224+
public enum RadarStatus
225+
{
226+
ErrorUnknown,
227+
ErrorServer,
228+
ErrorRateLimit,
229+
ErrorNotFound,
230+
ErrorForbidden,
231+
ErrorPaymentRequired,
232+
ErrorUnauthorized,
233+
ErrorBadRequest,
234+
ErrorNetwork,
235+
ErrorBluetooth,
236+
ErrorLocation,
237+
ErrorPermissions,
238+
ErrorPublishableKey,
239+
Success
240+
}
241+
242+
public class JSONObject : Dictionary<string, object> { }
243+
244+
}

‎RadarIO.Xamarin.sln

+17
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RadarIO.Xamarin.iOS.Binding
1515
EndProject
1616
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "iOSBindingTest", "Bindings\Tests\iOSBindingTest\iOSBindingTest.csproj", "{FB300B1C-CE9B-4441-8D28-928BB8912FE7}"
1717
EndProject
18+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Library", "Library", "{DB730659-604C-434D-93B4-9B10160BF05F}"
19+
EndProject
20+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RadarIO.Xamarin", "Library\RadarIO.Xamarin\RadarIO.Xamarin.csproj", "{4F609A57-4CA2-4243-858F-2132C55A560C}"
21+
EndProject
1822
Global
1923
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2024
Debug|Any CPU = Debug|Any CPU
@@ -75,6 +79,18 @@ Global
7579
{FB300B1C-CE9B-4441-8D28-928BB8912FE7}.Debug|iPhone.Build.0 = Debug|iPhone
7680
{FB300B1C-CE9B-4441-8D28-928BB8912FE7}.Release|iPhone.ActiveCfg = Release|iPhone
7781
{FB300B1C-CE9B-4441-8D28-928BB8912FE7}.Release|iPhone.Build.0 = Release|iPhone
82+
{4F609A57-4CA2-4243-858F-2132C55A560C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
83+
{4F609A57-4CA2-4243-858F-2132C55A560C}.Debug|Any CPU.Build.0 = Debug|Any CPU
84+
{4F609A57-4CA2-4243-858F-2132C55A560C}.Release|Any CPU.ActiveCfg = Release|Any CPU
85+
{4F609A57-4CA2-4243-858F-2132C55A560C}.Release|Any CPU.Build.0 = Release|Any CPU
86+
{4F609A57-4CA2-4243-858F-2132C55A560C}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
87+
{4F609A57-4CA2-4243-858F-2132C55A560C}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
88+
{4F609A57-4CA2-4243-858F-2132C55A560C}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
89+
{4F609A57-4CA2-4243-858F-2132C55A560C}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
90+
{4F609A57-4CA2-4243-858F-2132C55A560C}.Debug|iPhone.ActiveCfg = Debug|Any CPU
91+
{4F609A57-4CA2-4243-858F-2132C55A560C}.Debug|iPhone.Build.0 = Debug|Any CPU
92+
{4F609A57-4CA2-4243-858F-2132C55A560C}.Release|iPhone.ActiveCfg = Release|Any CPU
93+
{4F609A57-4CA2-4243-858F-2132C55A560C}.Release|iPhone.Build.0 = Release|Any CPU
7894
EndGlobalSection
7995
GlobalSection(SolutionProperties) = preSolution
8096
HideSolutionNode = FALSE
@@ -85,6 +101,7 @@ Global
85101
{24F46F22-0F9D-433C-804C-26414C49E637} = {85978DCB-4F9C-4CF0-872D-DD225AD71EF6}
86102
{5FB78078-54B6-4051-9657-542C56C8FE74} = {A1060F06-5B69-4231-A449-7A798D3CC5E6}
87103
{FB300B1C-CE9B-4441-8D28-928BB8912FE7} = {85978DCB-4F9C-4CF0-872D-DD225AD71EF6}
104+
{4F609A57-4CA2-4243-858F-2132C55A560C} = {DB730659-604C-434D-93B4-9B10160BF05F}
88105
EndGlobalSection
89106
GlobalSection(ExtensibilityGlobals) = postSolution
90107
SolutionGuid = {E2DB13CA-DFF2-4565-91BF-E73C6989750C}

0 commit comments

Comments
 (0)
Please sign in to comment.