This commit is contained in:
Nedim
2023-09-19 08:15:42 +02:00
parent c2d6923375
commit 85e695b2d8
7 changed files with 287 additions and 49 deletions

View File

@@ -18,6 +18,10 @@ type SensorData struct {
WifiLoc Location `json:"wifi_location"`
CellLoc Location `json:"cell_location"`
Temperature float64 `json:"temperature"`
// Used to parse incoming json data
AccInfo AccelerometerInfo `json:"accelerometerInfo"`
// Used to store coordinates of accelerometer to DB
AccelerometerInfo
}
type DeviceInfo struct {
@@ -25,8 +29,34 @@ type DeviceInfo struct {
RawJSON string `json:"raw_json" gorm:"type:json"`
SensorData
DeviceID uint
ExternalDeviceID string `json:"deviceId"`
}
type AccelerometerInfo struct {
X int64
Y int64
Z int64
}
type GeoJSONFeatureCollection struct {
Type string `json:"type"`
Features []GeoJSONFeature `json:"features"`
}
type GeoJSONFeature struct {
Type string `json:"type"`
Geometry GeoJSONGeometry `json:"geometry"`
DeviceInfo *DeviceInfo `json:",omitempty"`
Properties map[string]interface{} `json:"properties"`
}
type GeoJSONGeometry struct {
Type string `json:"type"`
Coordinates []float64 `json:"coordinates"`
}
func (DeviceInfo) Update() (bool, error) {
return false, nil
}
@@ -36,3 +66,6 @@ func (DeviceInfo) Create() (bool, error) {
func (DeviceInfo) Delete() (bool, error) {
return false, nil
}