-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
155 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
src/main/java/io/rudolph/netatmo/api/presence/model/AppType.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package io.rudolph.netatmo.api.presence.model | ||
|
||
enum class AppType(val value: String = "unknown") { | ||
CAMERA("app_camera"), | ||
UNKNOWN | ||
} |
13 changes: 13 additions & 0 deletions
13
src/main/java/io/rudolph/netatmo/api/presence/model/BaseEvent.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package io.rudolph.netatmo.api.presence.model | ||
|
||
import com.fasterxml.jackson.annotation.JsonAlias | ||
import com.fasterxml.jackson.annotation.JsonProperty | ||
|
||
data class BaseEvent( | ||
/** | ||
* Identifier of the event | ||
*/ | ||
@JsonProperty("id") | ||
@JsonAlias("id", "event_id") | ||
override val id: String? = null) | ||
: Event() |
121 changes: 62 additions & 59 deletions
121
src/main/java/io/rudolph/netatmo/api/presence/model/Event.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,74 +1,77 @@ | ||
package io.rudolph.netatmo.api.presence.model | ||
|
||
import com.fasterxml.jackson.annotation.JsonAlias | ||
import com.fasterxml.jackson.annotation.JsonProperty | ||
|
||
|
||
data class Event( | ||
/** | ||
* Subtypes of SD and Alim events. Go to Cameras page for further details. | ||
* | ||
* TODO change type to [EventSubType] | ||
*/ | ||
@JsonProperty("sub_type") | ||
val subType: String? = null, | ||
abstract class Event { | ||
/** | ||
* Subtypes of SD and Alim events. Go to Cameras page for further details. | ||
* | ||
* TODO change type to [EventSubType] | ||
*/ | ||
@JsonProperty("sub_type") | ||
val subType: EventType? = null | ||
|
||
/** | ||
* Camera that detected the event | ||
*/ | ||
@JsonProperty("camera_id") | ||
val cameraId: String? = null, | ||
/** | ||
* Camera that detected the event | ||
*/ | ||
@JsonProperty("camera_id") | ||
val cameraId: String? = null | ||
|
||
/** | ||
* Status of the video (recording, deleted or available) | ||
*/ | ||
@JsonProperty("video_status") | ||
val videoStatus: String? = null, | ||
/** | ||
* Status of the video (recording deleted or available) | ||
*/ | ||
@JsonProperty("video_status") | ||
val videoStatus: String? = null | ||
|
||
/** | ||
* Identifier of the event | ||
*/ | ||
@JsonProperty("id") | ||
val id: String? = null, | ||
/** | ||
* Identifier of the event | ||
*/ | ||
@JsonProperty("id") | ||
@JsonAlias("id", "event_id") | ||
open val id: String? = null | ||
|
||
/** | ||
* Time of occurence of event | ||
*/ | ||
@JsonProperty("time") | ||
val time: Int? = null, | ||
/** | ||
* Time of occurence of event | ||
*/ | ||
@JsonProperty("time") | ||
val time: Int? = null | ||
|
||
/** | ||
* Type of events. | ||
*/ | ||
@JsonProperty("type") | ||
val type: EventType? = null, | ||
/** | ||
* Type of events. | ||
*/ | ||
@JsonProperty("type") | ||
@JsonAlias("event_type", "type") | ||
val type: EventType? = null | ||
|
||
/** | ||
* User facing event description | ||
*/ | ||
@JsonProperty("message") | ||
val message: String? = null, | ||
/** | ||
* User facing event description | ||
*/ | ||
@JsonProperty("message") | ||
val message: String? = null | ||
|
||
/** | ||
* If person was considered "away" before being seen during this event | ||
*/ | ||
@JsonProperty("is_arrival") | ||
val isArrival: Boolean? = null, | ||
/** | ||
* If person was considered "away" before being seen during this event | ||
*/ | ||
@JsonProperty("is_arrival") | ||
val isArrival: Boolean? = null | ||
|
||
/** | ||
* Snapshot id, version and key. (Used in [io.rudolph.netatmo.api.presence.PresenceConnector.getCameraPicture]) | ||
*/ | ||
@JsonProperty("snapshot") | ||
val snapshot: Snapshot? = null, | ||
/** | ||
* Snapshot id version and key. (Used in [io.rudolph.netatmo.api.presence.PresenceConnector.getCameraPicture]) | ||
*/ | ||
@JsonProperty("snapshot") | ||
val snapshot: Snapshot? = null | ||
|
||
/** | ||
* Id of the person the event is about (if any) | ||
*/ | ||
@JsonProperty("person_id") | ||
val personId: String? = null, | ||
/** | ||
* Id of the person the event is about (if any) | ||
*/ | ||
@JsonProperty("person_id") | ||
val personId: String? = null | ||
|
||
/** | ||
* Identifier of the video | ||
*/ | ||
@JsonProperty("video_id") | ||
val videoId: String? = null | ||
) | ||
/** | ||
* Identifier of the video | ||
*/ | ||
@JsonProperty("video_id") | ||
val videoId: String? = null | ||
} |
5 changes: 0 additions & 5 deletions
5
src/main/java/io/rudolph/netatmo/api/presence/model/EventSubType.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
src/main/java/io/rudolph/netatmo/api/presence/model/PersonsEvent.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package io.rudolph.netatmo.api.presence.model | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty | ||
|
||
data class PersonsEvent( | ||
|
||
@JsonProperty("app_type") | ||
val appType: AppType, | ||
|
||
@JsonProperty("persons") | ||
val persons: List<PersonsEventPerson> = mutableListOf(), | ||
|
||
@JsonProperty("snapshot_id") | ||
val snapshotId: String?, | ||
|
||
@JsonProperty("snapshot_key") | ||
val snapshotKey: String?, | ||
|
||
@JsonProperty("home_id") | ||
val homeId: String, | ||
|
||
@JsonProperty("home_name") | ||
val homeName: String | ||
) : Event() |
17 changes: 17 additions & 0 deletions
17
src/main/java/io/rudolph/netatmo/api/presence/model/PersonsEventPerson.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package io.rudolph.netatmo.api.presence.model | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty | ||
|
||
data class PersonsEventPerson( | ||
@JsonProperty("id") | ||
val id: String, | ||
|
||
@JsonProperty("face_id") | ||
val faceId: String, | ||
|
||
@JsonProperty("face_key") | ||
val faceKey: String, | ||
|
||
@JsonProperty("is_known") | ||
val isKnown: Boolean = false | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
src/main/java/io/rudolph/netatmo/api/presence/transform/AppTypeDeserializer.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package io.rudolph.netatmo.api.presence.transform | ||
|
||
import com.fasterxml.jackson.core.JsonParser | ||
import com.fasterxml.jackson.databind.DeserializationContext | ||
import com.fasterxml.jackson.databind.JsonDeserializer | ||
import io.rudolph.netatmo.api.presence.model.AppType | ||
|
||
|
||
class AppTypeDeserializer : JsonDeserializer<AppType>() { | ||
override fun deserialize(p: JsonParser?, ctxt: DeserializationContext?): AppType { | ||
return p?.valueAsString?.let { name -> | ||
AppType.values().find { | ||
it.value == name | ||
} | ||
} ?: AppType.UNKNOWN | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters