-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moving MQTT message format to JSON (#36)
- Loading branch information
1 parent
c2bf746
commit 4725a00
Showing
2 changed files
with
58 additions
and
7 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
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,45 @@ | ||
package events | ||
|
||
type ItemConsumedMessage struct { | ||
EventSource string | ||
EventName string | ||
EventTime int64 | ||
UserID uint32 | ||
ItemID uint32 | ||
ItemName string | ||
ItemCost int32 | ||
ItemCount uint32 | ||
} | ||
|
||
type TotalItemConsumedForUserChangedMessage struct { | ||
EventSource string | ||
EventName string | ||
EventTime int64 | ||
UserID uint32 | ||
ItemID uint32 | ||
ItemName string | ||
ItemCost int32 | ||
TotalItemCount uint32 | ||
} | ||
|
||
type TotalItemConsumedChangedMessage struct { | ||
EventSource string | ||
EventName string | ||
EventTime int64 | ||
ItemID uint32 | ||
ItemName string | ||
ItemCost int32 | ||
TotalItemCount uint32 | ||
} | ||
|
||
func NewItemConsumedMessage(eventTime int64, userID uint32, itemID uint32, itemName string, itemCost int32, count uint32) *ItemConsumedMessage { | ||
return &ItemConsumedMessage{EventSource: "matomat", EventName: "item-consumed", EventTime: eventTime, UserID: userID, ItemID: itemID, ItemName: itemName, ItemCost: itemCost, ItemCount: count} | ||
} | ||
|
||
func NewTotalItemConsumedForUserChangedMessage(eventTime int64, userID uint32, itemID uint32, itemName string, itemCost int32, totalCount uint32) *TotalItemConsumedForUserChangedMessage { | ||
return &TotalItemConsumedForUserChangedMessage{EventSource: "matomat", EventName: "total-item-consumed-for-user-changed", EventTime: eventTime, UserID: userID, ItemID: itemID, ItemName: itemName, ItemCost: itemCost, TotalItemCount: totalCount} | ||
} | ||
|
||
func NewTotalItemConsumedChangedMessage(eventTime int64, itemID uint32, itemName string, itemCost int32, totalCount uint32) *TotalItemConsumedChangedMessage { | ||
return &TotalItemConsumedChangedMessage{EventSource: "matomat", EventName: "total-items-consumed", EventTime: eventTime, ItemID: itemID, ItemName: itemName, ItemCost: itemCost, TotalItemCount: totalCount} | ||
} |