Documentation
¶
Overview ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use p file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use p file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use p file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use p file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use p file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use p file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use p file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- type Alarm
- type AlarmHistory
- type AlarmInfo
- type AlarmInfos
- type AlarmNotification
- type AlarmPoint
- type AlarmPointInfo
- type AlarmTopic
- type BaiduBatchHistoryAlarmsResp
- type BaiduGetHistoryAlarmsResponse
- type BaiduGetStayPointResp
- type BaiduQueryStatusResponse
- type CircleGeofence
- type Collection
- type Config
- type CoordType
- type Engine
- type Entity
- type EntityRecord
- type Geofence
- type HistoryAlarmPoint
- type HistoryPrePoint
- type LastLocationStruct
- type Location
- type Manager
- type MonitoredStatus
- type Point
- type PolyGeofence
- type Repository
- type TrackPoint
- type UserId
- type Vertexe
Constants ¶
const (
AlarmMessageTopic = "iotx-foundry-alarm"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Alarm ¶
type Alarm struct {
FenceId string `json:"fence_id,noempty"`
FenceName string `json:"fence_name,noempty"`
MonitoredObjects []string `json:"monitored_objects"`
Action string `json:"action"`
AlarmPoint AlarmPoint `json:"alarm_point"`
PrePoint AlarmPoint `json:"pre_point"`
}
type AlarmHistory ¶
type AlarmHistory struct {
FenceId int `json:"fence_id"`
FenceName string `json:"fence_name"`
MonitoredPerson string `json:"monitored_person"`
Action string `json:"action"`
AlarmPoint HistoryAlarmPoint `json:"alarm_point"`
PrePoint HistoryPrePoint `json:"pre_point"`
}
type AlarmInfo ¶
type AlarmInfo struct {
FenceId int `json:"fence_id,noempty"`
FenceName string `json:"fence_name,noempty"`
MonitoredObjects string `json:"monitored_person"`
Action string `json:"action"`
AlarmPoint AlarmPointInfo `json:"alarm_point"`
PrePoint AlarmPointInfo `json:"pre_point"`
UserId string
}
type AlarmInfos ¶
type AlarmNotification ¶
type AlarmPoint ¶
type AlarmPointInfo ¶
type AlarmTopic ¶
type AlarmTopic struct {
TopicName string
Alarm *AlarmNotification `json:"alarm"`
}
func (*AlarmTopic) Deserialize ¶
func (p *AlarmTopic) Deserialize(buf []byte, opt message.SerializeOption) error
func (*AlarmTopic) Serialize ¶
func (p *AlarmTopic) Serialize(opt message.SerializeOption) ([]byte, error)
func (*AlarmTopic) SetTopic ¶
func (p *AlarmTopic) SetTopic(name string)
func (*AlarmTopic) Topic ¶
func (p *AlarmTopic) Topic() string
type BaiduBatchHistoryAlarmsResp ¶
type BaiduBatchHistoryAlarmsResp struct {
Status int `json:"status"`
Message string `json:"message"`
Size int `json:"size"`
Total int `json:"total"`
Alarms []AlarmHistory `json:"alarms"`
}
type BaiduGetHistoryAlarmsResponse ¶
type BaiduGetHistoryAlarmsResponse struct {
Status int `json:"status"`
Message string `json:"message"`
Size int `json:"size"`
Alarms []AlarmHistory `json:"alarms"`
}
type BaiduGetStayPointResp ¶
type BaiduQueryStatusResponse ¶
type BaiduQueryStatusResponse struct {
Status int `json:"status"`
Message string `json:"message"`
Size int `json:"size"`
MonitoredStatuses []MonitoredStatus `json:"monitored_statuses"`
}
type CircleGeofence ¶
type Collection ¶
type Engine ¶
type Engine interface {
// Add monitored object's track points
AddTrackPoint(point TrackPoint)
AddTrackPoints(points []TrackPoint)
// Create circle geofence and return goefence id if successful
CreateCircleGeofence(c CircleGeofence) (string, error)
// Update an existed geofence
UpdateCircleGeofence(c CircleGeofence) error
// Delete an existed geofence or monitored objects
DeleteGeofence(fenceIds []string, objects []string) ([]string, error)
// List geofences matched with ids or objects
ListGeofence(fenceIds []string, objects []string) ([]*Geofence, error)
// Add monitored object for specifed geofence
AddMonitoredObject(fenceId string, objects []string) error
// Remove monitored object from specified geofence
RemoveMonitoredObject(fenceId string, objects []string) error
// List monitored object in specifed geofence
ListMonitoredObjects(fenceId string, pageIndex int, pageSize int) (int, []string)
// Create poly geofence and return goefence id if successful
CreatePolyGeofence(c PolyGeofence) (string, error)
// Update an existed poly geofence
UpdatePolyGeofence(c PolyGeofence) error
// Alarms
QueryStatus(monitoredPerson string, fenceIds []string) (BaiduQueryStatusResponse, error)
GetHistoryAlarms(monitoredPerson string, fenceIds []string) (BaiduGetHistoryAlarmsResponse, error)
BatchGetHistoryAlarms(input *grpc_pandas_v1.BatchGetHistoryAlarmsRequest) (BaiduBatchHistoryAlarmsResp, error)
GetStayPoints(input *grpc_pandas_v1.GetStayPointsRequest) (BaiduGetStayPointResp, error)
UnmarshalAlarmNotification(content []byte) (*AlarmNotification, error)
//Entity
AddEntity(EntityName string, EntityDesc string) error
UpdateEntity(EntityName string, EntityDesc string) error
DeleteEntity(EntityName string) error
ListEntity(userId string, collectionId string, CoordTypeOutput string, PageIndex int32, pageSize int32) (int, baiduListEntityStruct)
}
func NewEngine ¶
func NewEngine(r Repository) (Engine, error)
type Entity ¶
type Entity struct {
EntityName string `json:"entity_name"`
EntityDesc string `json:"entity_desc"`
LastLocation LastLocationStruct `json:"latest_location"`
}
type EntityRecord ¶
type Geofence ¶
type Geofence struct {
FenceId int `json:"fence_id"`
FenceName string `json:"fence_name"`
MonitoredObject string `json:"monitored_person"`
Shape string `json:"shape"`
Longitude float64 `json:"longitude"`
Latitude float64 `json:"latitude"`
Radius float64 `json:"radius"`
CoordType CoordType `json:"coord_type"`
Denoise int `json:"denoise"`
CreateTime string `json:"create_time"`
UpdateTime string `json:"modify_time"`
Vertexes []Vertexe `json:"vertexes"`
}
type HistoryAlarmPoint ¶
type HistoryPrePoint ¶
type LastLocationStruct ¶
type Location ¶
type Location struct {
Latitude float64 `json:"latitude"`
Longitude float64 `json:"longitude"`
Time string `json:"loc_time"`
}
Location is reported by iot terminal to lbs service
type Manager ¶
type Manager interface {
// Add monitored object's track points
AddTrackPoint(principal auth.Principal, point TrackPoint)
AddTrackPoints(principal auth.Principal, points []TrackPoint)
// Create circle geofence and return goefence id if successful
CreateCircleGeofence(principal auth.Principal, c CircleGeofence) (string, error)
// Update an existed geofence
UpdateCircleGeofence(principal auth.Principal, c CircleGeofence) error
// Delete an existed geofence or monitored objects
DeleteGeofence(principal auth.Principal, fenceIds []string, objects []string) ([]string, error)
// List geofences matched with ids or objects
ListGeofence(principal auth.Principal, fenceIds []string, objects []string) ([]*Geofence, error)
// Add monitored object for specifed geofence
AddMonitoredObject(principal auth.Principal, fenceId string, objects []string) error
// Remove monitored object from specified geofence
RemoveMonitoredObject(principal auth.Principal, fenceId string, objects []string) error
// List monitored object in specifed geofence
ListMonitoredObjects(principal auth.Principal, fenceId string, pageIndex int, pageSize int) (int, []string)
// Create poly geofence and return goefence id if successful
CreatePolyGeofence(principal auth.Principal, c PolyGeofence) (string, error)
// Update an existed poly geofence
UpdatePolyGeofence(principal auth.Principal, c PolyGeofence) error
// Alarms
QueryStatus(principal auth.Principal, monitoredPerson string, fenceIds []string) (BaiduQueryStatusResponse, error)
GetHistoryAlarms(principal auth.Principal, monitoredPerson string, fenceIds []string) (BaiduGetHistoryAlarmsResponse, error)
BatchGetHistoryAlarms(principal auth.Principal, input *grpc_pandas_v1.BatchGetHistoryAlarmsRequest) (BaiduBatchHistoryAlarmsResp, error)
GetStayPoints(principal auth.Principal, input *grpc_pandas_v1.GetStayPointsRequest) (BaiduGetStayPointResp, error)
UnmarshalAlarmNotification(principal auth.Principal, content []byte) (*AlarmNotification, error)
//Entity
AddEntity(principal auth.Principal, EntityName string, EntityDesc string) error
UpdateEntity(principal auth.Principal, EntityName string, EntityDesc string) error
DeleteEntity(principal auth.Principal, EntityName string) error
ListEntity(principal auth.Principal, collectionId string, CoordTypeOutput string, PageIndex int32, pageSize int32) (int, baiduListEntityStruct)
}
func NewManager ¶
func NewManager(engine string, r Repository) (Manager, error)
type MonitoredStatus ¶
type PolyGeofence ¶
type Repository ¶
type Repository interface {
// Helper
AddCollection(userId string, collectionId string) error
RemoveCollection(userId string, collectionId string) error
GetAllCollections() ([]*Collection, error)
UpdateCollection(userId string, p *Collection) error
// Geofences
AddGeofence(userId string, collectionId string, fenceName string, fenceId string) error
RemoveGeofence(userId string, collectionId string, fenceId string) error
IsGeofenceExistWithName(userId string, collectionId string, fenceName string) bool
IsGeofenceExistWithId(userId string, collectionId string, fenceId string) bool
GetFences(userId, collectionId string) ([]*geofenceRecord, error)
GetFenceUserId(fenceId string) (string, error)
//Entity
AddEntity(userId string, collectionId string, entityName string) error
DeleteEntity(userId string, collectionId string, entityName string) error
UpdateEntity(userId string, collectionId string, entityName string, entity EntityRecord) error
IsEntityExistWithName(userId string, collectionId string, entityName string) bool
GetEntities(userId string, collectionId string) ([]*EntityRecord, error)
Close()
}
func NewRepository ¶
func NewRepository() Repository