simulating

package
v0.0.0-...-7ff6187 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2021 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataGenerator

type DataGenerator struct {
	CapabilityModel *models.DeviceCapabilityModel // the capability model of the device.
	// contains filtered or unexported fields
}

DataGenerator generates telemetry messages and reported property updates based on the device capability model.

func NewDataGenerator

func NewDataGenerator(capabilityModel *models.DeviceCapabilityModel, geopoints [][3]float64) *DataGenerator

func (*DataGenerator) GenerateC2DAck

func (d *DataGenerator) GenerateC2DAck(c2dMsg *common.Message) *common.Message

GenerateTwinUpdate creates a reported properties ACK based on the desired properties

func (*DataGenerator) GenerateReportedProperties

func (d *DataGenerator) GenerateReportedProperties(device *device) (iotdevice.TwinState, error)

GenerateReportedProperties generate reported property update based on the device capability model.

func (*DataGenerator) GenerateTelemetryMessage

func (d *DataGenerator) GenerateTelemetryMessage(device *device, creationTime time.Time) ([]*telemetryMessage, error)

GenerateTelemetryMessage generate a telemetry messages based on the device capability model.

func (*DataGenerator) GenerateTwinUpdateAck

func (d *DataGenerator) GenerateTwinUpdateAck(desiredTwin iotdevice.TwinState) iotdevice.TwinState

GenerateTwinUpdate creates a reported properties ACK based on the desired properties

type DeviceProvisioner

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

DeviceProvisioner responsible for provisioning devices via DPS.

func NewProvisioner

func NewProvisioner(ctx context.Context, cfg *config.SimulationConfig) *DeviceProvisioner

NewProvisioner creates a new deviceProvisioner.

func (*DeviceProvisioner) Provision

Provision provisions a device in IoT Central

type ProvisioningRequest

type ProvisioningRequest struct {
	DeviceID   string                   // device deviceID to register the device as.
	Context    context.Context          // context of the provision request.
	Simulation *models.Simulation       // simulation that is requesting the device provision.
	Target     *models.SimulationTarget // target to provision the device with.
	Model      *models.DeviceModel      // model to associate with the device.
}

ProvisioningRequest represents a request to provision a device in IoT Central.

type ProvisioningResponse

type ProvisioningResponse struct {
	*ProvisioningRequest        // the request to which this response is generated.
	ConnectionString     string // Result of the provision request.
}

ProvisioningResponse represents the response for a given provision request.

type Simulator

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

Simulator simulates a number of devices connecting to IoT Central

func Start

func Start(
	ctx context.Context,
	config *config.SimulationConfig,
	simulation *models.Simulation) (*Simulator, error)

Start starts the simulation.

func (*Simulator) GetConnectedDeviceCount

func (s *Simulator) GetConnectedDeviceCount(modelId string) int

func (*Simulator) Stop

func (s *Simulator) Stop() error

Stop stops the simulation

Jump to

Keyboard shortcuts

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