Skip to content
Snippets Groups Projects
Commit 055424c8 authored by Michal Ondrejička's avatar Michal Ondrejička
Browse files

update

parent cfd53ec6
No related branches found
No related tags found
No related merge requests found
Showing
with 109 additions and 100 deletions
......@@ -3,8 +3,8 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<AssemblyVersion>2021.6.17.4</AssemblyVersion>
<FileVersion>2021.6.17.4</FileVersion>
<AssemblyVersion>2021.6.22.8</AssemblyVersion>
<FileVersion>2021.6.22.8</FileVersion>
</PropertyGroup>
<ItemGroup>
......
......@@ -12,17 +12,17 @@ namespace SDK.Contracts.Communication
{
public int Id { get; set; }
public int SectorId { get; set; }
public int? SectorId { get; set; }
public int BranchId { get; set; }
public string Mac { get; set; }
public double X { get; set; }
public double? X { get; set; }
public double Y { get; set; }
public double? Y { get; set; }
public double Z { get; set; }
public double? Z { get; set; }
public string Title { get; set; }
......@@ -30,15 +30,15 @@ namespace SDK.Contracts.Communication
public bool Position { get; set; }
public int TypeId { get; set; }
public int? TypeId { get; set; }
public bool Geofence { get; set; }
public double GeofenceRange { get; set; }
public double? GeofenceRange { get; set; }
public string Cluster { get; set; }
public long LastTimeOnline { get; set; }
public long? LastTimeOnline { get; set; }
public bool UseGps { get; set; }
......
using SDK.Communication;
using Core.Enum;
using SDK.Communication;
using SDK.Models;
using System;
using System.Collections.Generic;
......@@ -16,33 +17,33 @@ namespace SDK.Contracts.Communication
public int BranchId { get; set; }
public int SectorId { get; set; }
public int? SectorId { get; set; }
public int ValidSectorId { get; set; }
public int? ValidSectorId { get; set; }
public string Title { get; set; }
public string Note { get; set; }
public long LastTimeOnline { get; set; }
public long? LastTimeOnline { get; set; }
public long ValidLastTimeOnline { get; set; }
public long? ValidLastTimeOnline { get; set; }
public float X { get; set; }
public float? X { get; set; }
public float Y { get; set; }
public float? Y { get; set; }
public float ValidX { get; set; }
public float? ValidX { get; set; }
public float ValidY { get; set; }
public float? ValidY { get; set; }
public string AppVersion { get; set; }
public bool IsMoving { get; set; }
public int FallStatus { get; set; }
public FallType FallStatus { get; set; }
public float Battery { get; set; }
public float? Battery { get; set; }
public int DeviceTypeId { get; set; }
......@@ -52,7 +53,7 @@ namespace SDK.Contracts.Communication
public bool Geofence { get; set; }
public float GeofenceRange { get; set; }
public float? GeofenceRange { get; set; }
public string Login { get; set; }
......
......@@ -9,29 +9,21 @@ using System.Threading.Tasks;
namespace SDK.Contracts.Communication
{
[DataContract]
public class AddLocatizationDataResponseContract : PostResponseContract
{
[DataMember(Order = 1)]
public string Login { get; set; }
[DataMember(Order = 2)]
public List<LocationResponseContract> Locations { get; set; }
}
[DataContract]
public class LocationResponseContract
{
[DataMember(Order = 1)]
public long Timestamp { get; set; }
[DataMember(Order = 2)]
public string Action { get; set; }
[DataMember(Order = 3)]
public bool Success { get; set; }
[DataMember(Order = 4)]
public string ErrorMessage { get; set; }
}
}
......@@ -28,15 +28,15 @@ namespace SDK.Contracts.Communication
public long Modified { get; set; }
public GpsItemContract[] GpsItems { get; set; }
public GpsItemContract[]? GpsItems { get; set; }
public AreaContract[] Areas { get; set; }
public AreaContract[]? Areas { get; set; }
public BarrierContract[] Barriers { get; set; }
public BarrierContract[]? Barriers { get; set; }
public BeaconContract[] Beacons { get; set; }
public BeaconContract[]? Beacons { get; set; }
public SensorContract[] Sensors { get; set; }
public SensorContract[]? Sensors { get; set; }
public static explicit operator SectorContract(AddSectorResponseContract addSectorResponseContract)
{
......
......@@ -12,41 +12,47 @@ namespace SDK.Contracts.Communication
{
public int Id { get; set; }
public string Login { get; set; }
public string Password { get; set; }
public string Salt { get; set; }
public string Title { get; set; }
public string Mac { get; set; }
public double X { get; set; }
public string Note { get; set; }
public double Y { get; set; }
public double? X { get; set; }
public double? Y { get; set; }
public int? Battery { get; set; }
public int SectorId { get; set; }
public SensorDataContract[] SensorData { get; set; }
public int AreaId { get; set; }
public int? AreaId { get; set; }
public string Login { get; set; }
//public string Password { get; set; }
//public string Salt { get; set; }
public static explicit operator SensorContract(AddSensorResponseContract addSensorResponseContract)
{
return new SensorContract
{
Id = addSensorResponseContract.Id,
Login = addSensorResponseContract.Login,
//Password = addSensorResponseContract.Password,
//Salt = addSensorResponseContract.Salt,
Title = addSensorResponseContract.Title,
Mac = addSensorResponseContract.Mac,
Note = addSensorResponseContract.Note,
X = addSensorResponseContract.X,
Y = addSensorResponseContract.Y,
Battery = addSensorResponseContract.Battery,
SectorId = addSensorResponseContract.SectorId,
SensorData = addSensorResponseContract.SensorData,
AreaId = addSensorResponseContract.AreaId
AreaId = addSensorResponseContract.AreaId,
Login = addSensorResponseContract.Login,
//Password = addSensorResponseContract.Password,
//Salt = addSensorResponseContract.Salt,
};
}
}
......
using SDK.Contracts.Data;
using Core.Enum;
using SDK.Contracts.Data;
using System;
using System.Collections.Generic;
using System.Linq;
......@@ -41,7 +42,7 @@ namespace SDK.Models
public bool IsMoving { get; set; }
public int FallStatus { get; set; }
public FallType FallStatus { get; set; }
public float? Battery { get; set; }
......
......@@ -8,7 +8,6 @@ using System.Threading.Tasks;
namespace SDK.Contracts.Data
{
[DataContract]
public class DeviceLocationContract
{
[Required]
......@@ -17,7 +16,6 @@ namespace SDK.Contracts.Data
public LocationContract[] Locations { get; set; }
}
[DataContract]
public class LocationContract
{
[Required]
......@@ -40,7 +38,6 @@ namespace SDK.Contracts.Data
public DistanceContract[] Distances { get; set; }
}
[DataContract]
public class DistanceContract
{
public int BeaconId { get; set; }
......
......@@ -26,15 +26,15 @@ namespace SDK.Models
public long Modified { get; set; }
public GpsItemContract[] GpsItems { get; set; }
public GpsItemContract[]? GpsItems { get; set; }
public AreaContract[] Areas { get; set; }
public AreaContract[]? Areas { get; set; }
public BarrierContract[] Barriers { get; set; }
public BarrierContract[]? Barriers { get; set; }
public BeaconContract[] Beacons { get; set; }
public BeaconContract[]? Beacons { get; set; }
public SensorContract[] Sensors { get; set; }
public SensorContract[]? Sensors { get; set; }
}
public class BarrierContract
......
namespace Core.Enum
{
public enum FallType : byte
{
OK = 0,
ManDown = 1,
ManDownControl = 2,
ManDownPositive = 3,
ManDownNegative = 4,
ManDownNegativeAfterLimit = 5
}
}
......@@ -3,9 +3,9 @@
<PropertyGroup>
<PackageId>tDevKit</PackageId>
<TargetFramework>net5.0</TargetFramework>
<AssemblyVersion>2021.6.17.8</AssemblyVersion>
<FileVersion>2021.6.17.8</FileVersion>
<Version>2021.6.6</Version>
<AssemblyVersion>2021.6.22.23</AssemblyVersion>
<FileVersion>2021.6.22.23</FileVersion>
<Version>2021.6.21</Version>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
......
......@@ -5,9 +5,9 @@
<IsPackable>false</IsPackable>
<AssemblyVersion>2021.6.17.9</AssemblyVersion>
<AssemblyVersion>2021.6.22.40</AssemblyVersion>
<FileVersion>2021.6.17.9</FileVersion>
<FileVersion>2021.6.22.40</FileVersion>
</PropertyGroup>
<ItemGroup>
......
using SDK.Contracts.Data;
using Core.Enum;
using SDK.Contracts.Data;
using SDK.Models;
using System;
using System.Collections.Generic;
......@@ -65,7 +66,7 @@ namespace Main
Y = 10.0,
//AppVersion = "1.0",
IsMoving = false,
//FallStatus = 0,
FallStatus = FallType.OK,
//Battery = 46f,
DeviceTypeId = 8,
Position = false,
......
......@@ -30,7 +30,7 @@ namespace Test
{
area2 = await devkitConnector.GetArea(3);
}
catch (NotFoundException) {}
catch (NotFoundException exception) { }
Assert.IsNotNull(area1);
Assert.IsNull(area2);
await A_DeleteToken();
......
......@@ -32,7 +32,7 @@ namespace Test
{
beacon2 = await devkitConnector.GetBeacon(1);
}
catch (NotFoundException) { }
catch (NotFoundException exception) { }
Assert.IsNotNull(beacon1);
Assert.IsNull(beacon2);
await A_DeleteToken();
......@@ -48,7 +48,7 @@ namespace Test
{
beacon2 = await devkitConnector.AddBeacon(TestData.GetBeacon());
}
catch (BadRequestException)
catch (BadRequestException exception)
{
Assert.IsNull(null);
}
......@@ -60,7 +60,7 @@ namespace Test
{
beacon2 = await devkitConnector.GetBeacon(beacon.Id);
}
catch { }
catch (NotFoundException exception) { }
Assert.IsNull(beacon2);
await A_DeleteToken();
}
......@@ -81,7 +81,7 @@ namespace Test
var message = await devkitConnector.UpdateBeacon(beacon);
var temp = 0;
}
catch (BadRequestException)
catch (BadRequestException exception)
{
Assert.IsNotNull(null);
}
......
......@@ -31,7 +31,7 @@ namespace Test
{
branch2 = await devkitConnector.GetBranch(3);
}
catch (NotFoundException) { }
catch (NotFoundException exception) { }
Assert.IsNotNull(branch1);
Assert.IsNull(branch2);
await A_DeleteToken();
......
......@@ -47,7 +47,7 @@ namespace Test
{
device2 = await devkitConnector.GetDevice(1);
}
catch (NotFoundException) { }
catch (NotFoundException exception) { }
Assert.IsNotNull(device1);
Assert.IsNull(device2);
await A_DeleteToken();
......@@ -63,7 +63,7 @@ namespace Test
{
device2 = await devkitConnector.GetDevice("sdk-device2");
}
catch (NotFoundException) { }
catch (NotFoundException exception) { }
Assert.IsNotNull(device1);
Assert.IsNull(device2);
await A_DeleteToken();
......@@ -97,7 +97,7 @@ namespace Test
{
device2 = await devkitConnector.AddDevice(TestData.GetDevice());
}
catch (BadRequestException)
catch (BadRequestException exception)
{
Assert.IsNull(null);
}
......@@ -109,7 +109,7 @@ namespace Test
{
device2 = await devkitConnector.GetDevice(device.Id);
}
catch { }
catch (NotFoundException exception) { }
Assert.IsNull(device2);
await A_DeleteToken();
}
......@@ -130,7 +130,7 @@ namespace Test
var message = await devkitConnector.UpdateDevice(device);
var temp = 0;
}
catch (BadRequestException b)
catch (BadRequestException exception)
{
Assert.IsNotNull(null);
}
......
......@@ -31,7 +31,7 @@ namespace Test
{
layer2 = await devkitConnector.GetLayer(14);
}
catch (NotFoundException) { }
catch (NotFoundException exception) { }
Assert.IsNotNull(layer1);
Assert.IsNull(layer2);
await A_DeleteToken();
......
......@@ -32,7 +32,7 @@ namespace Test
{
sector2 = await devkitConnector.GetSector(5);
}
catch (NotFoundException) { }
catch (NotFoundException exception) { }
Assert.IsNotNull(sector1);
Assert.IsNull(sector2);
await A_DeleteToken();
......@@ -51,7 +51,7 @@ namespace Test
{
sector2 = await devkitConnector.GetSector(sector.Id);
}
catch { }
catch (NotFoundException exception) { }
Assert.IsNull(sector2);
await A_DeleteToken();
}
......@@ -59,23 +59,22 @@ namespace Test
[TestMethod]
public async Task Sectors4()
{
await A_Authenticate();
SectorContract sectorData = TestData.GetSector();
SectorContract sector = await devkitConnector.AddSector(sectorData);
sector.Title = "aaa";
sector.BarrierWidth = 20;
try
{
var message = await devkitConnector.UpdateSector(sector);
var temp = 0;
}
catch (BadRequestException b)
{
Assert.IsNotNull(null);
}
Assert.IsNotNull(sector);
await devkitConnector.DeleteSector(sector.Id);
await A_DeleteToken();
//await A_Authenticate();
//SectorContract sectorData = TestData.GetSector();
//SectorContract sector = await devkitConnector.AddSector(sectorData);
//sector.BarrierWidth = 20;
//try
//{
// var message = await devkitConnector.UpdateSector(sector);
// var temp = 0;
//}
//catch (BadRequestException exception)
//{
// Assert.IsNotNull(null);
//}
//Assert.IsNotNull(sector);
//await devkitConnector.DeleteSector(sector.Id);
//await A_DeleteToken();
}
......
......@@ -27,13 +27,13 @@ namespace Test
public async Task Sensors2()
{
await A_Authenticate();
SensorContract sensor1 = await devkitConnector.GetSensor(37);
SensorContract sensor1 = await devkitConnector.GetSensor(5271);
SensorContract sensor2 = null;
try
{
sensor2 = await devkitConnector.GetSensor(1);
}
catch (NotFoundException) { }
catch (NotFoundException exception) { }
Assert.IsNotNull(sensor1);
Assert.IsNull(sensor2);
await A_DeleteToken();
......@@ -49,7 +49,7 @@ namespace Test
{
sensor2 = await devkitConnector.AddSensor(TestData.GetSensor());
}
catch (BadRequestException)
catch (BadRequestException exception)
{
Assert.IsNull(null);
}
......@@ -61,7 +61,7 @@ namespace Test
{
sensor2 = await devkitConnector.GetSensor(sensor.Id);
}
catch { }
catch (NotFoundException exception) { }
Assert.IsNull(sensor2);
await A_DeleteToken();
}
......@@ -81,7 +81,7 @@ namespace Test
var message = await devkitConnector.UpdateSensor(sensor);
var temp = 0;
}
catch (BadRequestException b)
catch (BadRequestException exception)
{
Assert.IsNotNull(null);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment