Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polygon area type added #195

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions code/API_definitions/geofencing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ paths:
examples:
CIRCLE_AREA_ENTERED:
$ref: "#/components/examples/REQUEST_CIRCLE_AREA_ENTERED"
POLYGON_AREA_ENTERED:
$ref: "#/components/examples/REQUEST_POLYGON_AREA_ENTERED"
required: true
callbacks:
event-notifications:
Expand All @@ -123,6 +125,8 @@ paths:
$ref: "#/components/examples/CIRCLE_AREA_ENTERED"
CIRCLE_AREA_LEFT:
$ref: "#/components/examples/CIRCLE_AREA_LEFT"
POLYGON_AREA_ENTERED:
$ref: "#/components/examples/POLYGON_AREA_ENTERED"
SUBSCRIPTION_ENDS:
$ref: "#/components/examples/SUBSCRIPTION_ENDS"
responses:
Expand Down Expand Up @@ -310,14 +314,17 @@ components:
propertyName: areaType
mapping:
CIRCLE: "#/components/schemas/Circle"
POLYGON: "#/components/schemas/Polygon"

AreaType:
type: string
description: |
Type of this area.
CIRCLE - The area is defined as a circle.
POLYGON - The area is defined as polygon.
enum:
- CIRCLE
- POLYGON

Circle:
description: Circular area
Expand All @@ -342,6 +349,36 @@ components:
longitude: 7.10066
radius: 50000

Polygon:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For coherence, we should use same schema that we already have defined for location-retrieval: https://github.com/camaraproject/DeviceLocation/blob/main/code/API_definitions/location-retrieval.yaml#L289, which is very similar, but uses boundary and maxItems is 15

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. The change is done.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, we have to conclude the discussion in the issue #194 before deciding on the PR

description: Polygon based area defined by an ordered geo points array
type: object
allOf:
- $ref: "#/components/schemas/Area"
- type: object
required:
- boundary
properties:
boundary:
$ref: "#/components/schemas/PointList"
example:
areaType: POLYGON
boundary:
- latitude: 52.516770
longitude: 13.378156
- latitude: 52.516841
longitude: 13.379433
- latitude: 52.515917
longitude: 13.37959
- latitude: 52.515849
longitude: 13.378308

PointList:
type: array
items:
$ref: "#/components/schemas/Point"
minItems: 3
maxItems: 15

Point:
type: object
description: Coordinates (latitude, longitude) defining a location in a map
Expand Down Expand Up @@ -901,3 +938,48 @@ components:
device:
phoneNumber: +123456789
terminationReason: SUBSCRIPTION_EXPIRED

REQUEST_POLYGON_AREA_ENTERED:
value:
webhook:
notificationUrl: https://application-server.com
notificationAuthToken: c8974e592c2fa383d4a3960714
subscriptionDetail:
device:
phoneNumber: "+12345678912"
area:
areaType: POLYGON
boundary:
- latitude: 52.516770
longitude: 13.378156
- latitude: 52.516841
longitude: 13.379433
- latitude: 52.515917
longitude: 13.37959
- latitude: 52.515849
longitude: 13.378308
type: org.camaraproject.geofencing.v0.area-entered
ilya-smirnov-berlin marked this conversation as resolved.
Show resolved Hide resolved
subscriptionExpireTime: 2024-03-22T05:40:58.469Z
POLYGON_AREA_ENTERED:
value:
id: "123655"
source: https://notificationSendServer12.supertelco.com
type: org.camaraproject.geofencing.v0.area-entered
specversion: "1.0"
datacontenttype: application/json
time: 2023-03-22T05:40:23.682Z
data:
subscriptionId: 987654321
device:
phoneNumber: +123456789
area:
areaType: POLYGON
boundary:
- latitude: 52.516770
longitude: 13.378156
- latitude: 52.516841
longitude: 13.379433
- latitude: 52.515917
longitude: 13.37959
- latitude: 52.515849
longitude: 13.378308