restAPI

package
v0.0.0-...-5cdd5eb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 31, 2018 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JsonCameraInput

type JsonCameraInput struct {
	Name   *string `json:"Name"`
	Ipaddr *string `json:"Ipaddr"`
	Port   *string `json:"Port"`
	Desc   *string `json:"Desc"`
	//Integer status value and '0'(default value) is not a vaid input. so no
	// need to use it as pointer.
	Status       dataSet.CameraStatus `json:"Status"`
	UserId       *string              `json:"UserId"`
	Pwd          *string              `json:"Pwd"`
	VideoLenSec  uint64               `json:"VideoLenSec"`
	SnapInterval uint64               `json:"VideoSnapInterval"`
}

Must be updated when original camera structure is modified. This structure has one to one mapping to original camera structure. The camera parameters that are exposed to outside world for input are only included in this Json. When deseralizing the data from json, application must know if the field is being notprovided or empty value. Json unmarshalling set all the unprovided values to its default. i.e for string it is "", for integer its 0 and so on. So to distinguish default from unprovided values, a model struct is being used instead of using original structure for unmarshalling. The new model keep 1:1 mapping to all the fields in original structure except their datatypes. The datatypes are set to pointer for every field which need to accept default values as valid input.

func (*JsonCameraInput) AllocateFields

func (jsonCam *JsonCameraInput) AllocateFields()

Allocate memory to all the string fields that needed for the json structure.

func (*JsonCameraInput) ReadJsonData

func (jsonCam *JsonCameraInput) ReadJsonData(camRowOut *dataSet.Camera)

Read the data from Json structure 'jsonCam' and populate the 'camRowOut'. This function leave the'camRowOut' fields untouched when its not set in input 'jsonCam'

type RestAPI

type RestAPI struct {
	// contains filtered or unexported fields
}

func (*RestAPI) RestAPIMainHandler

func (handler *RestAPI) RestAPIMainHandler(listenIp string,
	listenPort string) error

The main handler function for handling http rest request. Normally they are running in seperate goroutine.

func (*RestAPI) RestHandlerThread

func (handler *RestAPI) RestHandlerThread(addr string,
	handlerFn http.Handler)

The rest handler thread to manage rest APIs. Must be called as a go-routine.

type Routes

type Routes struct {
	// contains filtered or unexported fields
}

func (*Routes) CreateAllRoutes

func (routeObj *Routes) CreateAllRoutes()

func (*Routes) NewRouter

func (routeObj *Routes) NewRouter() *mux.Router

NewRouter function configures a new router to the API

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL