iDigi Logo
iDigi Device Connector API

Apex Controller and Controller Extensions

AccountExtension

This extension is used by VisualForce pages that replace both the "New" view and the "Detail" view of an iDigi_Account__c object.

Instance Methods

PageReference refreshReadings()

Function called from button on AccountDetail page, used to refresh the iDigi_Device objects associated with this account.

PageReference save()

Method called when save button is clicked on iDigiAccountNew.page.

Instance Properties

iDigi_Account__c idigi_account

Object referenced by iDigiAccountNew.page.

HttpResponse testHttpResponse

Property used by automated tests as substitute for XML response from Http.send() call in DeviceCore.refreshDeviceList().

DeviceExtension

Controller Extension for iDigi Device object, used to support a button on DeviceDetail.page for refreshing Dia Readings on the given device.

Constructors

DeviceExtension( ApexPages.StandardController stdController)

Standard constructor for when this class is used as a Controller Extension.

Instance Methods

List<Dia_Channel__c> getReadings()

Initialize instance property setCon with query and return a list of Dia_Channel__c records.

PageReference readDia()

Connect to iDigi server and check for more Dia Readings for this device. Refreshes the current page to display the new readings and updates Dia Status and Dia Refresh fields of the iDigi Device.

Instance Properties

String remainingRecords

Status string shown to user on DeviceDetail.page.

ApexPages.StandardSetController setCon

A StandardSetController of the latest channel readings for this instance's iDigi Device object, sorted by instance and channel.  Used on DeviceDetail.page to show the current reading of every channel.

HttpResponse testHttpResponse

Property used by automated tests as substitute for XML response from Http.send() call in Dia.loadChannelData().

ChartController

This controller, combined with ChartDemo.page, is a sample of using Dia Readings to create a chart (using the apex:chart component).

Constructors

ChartController( ApexPages.StandardController stdController)

Standard constructor for a controller extension. Loads instance properties referenced on the Visualforce page.

Classes

Data

Datatype for points used in chart on ChartDemo.page. Constructor takes an AggregateResult with ‘hour’, ‘min’, ‘avg’, and ‘max’ fields.

Static Methods

List<Data> getChartData( Id channel_id)

Function shared by getData() instance and getRemoteData() static methods to provide data for Apex charts.

List<Data> getRemoteData( Id channel_id)

Make the chart data available via JavaScript remoting.

Instance Methods

List<Data> getData()

Method used by ChartDemo.page to get data for its chart.

PageReference readDia()

Connect to iDigi server and check for more Dia Readings for this channel’s device. Refreshes the current page to display the new readings and updates Dia Status and Dia Refresh fields of the iDigi Device.

Instance Properties

Dia_Channel__c channel

Object referenced by ChartDemo.page.

HttpResponse testHttpResponse

Property used by automated tests as substitute for XML response from Http.send() call in Dia.loadChannelData().

String xAxisTitle
String yAxisTitle
String chartTitle

Titles set by the ChartController constructor and used by ChartDemo.page.

GoogleChartController

This controller, combined with GoogleChartDemo.page, is a sample of using Dia Readings to create a chart (using the Google Visualization/Chart API).

Constructors

GoogleChartController(ApexPages.StandardController stdController)

Standard constructor for a controller extension.

Classes

Data

Datatype used by getChartData() method.  Has a String member (x) representing the x-axis label, and Double members (min, max, avg) to store the minimum, maximum and average reading for a given time period.

 

DataRaw

Datatype used by getChartDataRaw() method.  Has a DateTime member (dateValue) and Double member (value), which represents a single data reading.

 

Title

Datatype used by getChartTitle() method.  Has String members xAxisTitle, yAxisTitle and chartTitle.

Static Methods

Title getChartTitle(Id channel_id)

Provides a title and labels for the axes of the first chart on the page (day, week or month).

List<Data> getChartData(Id channel_id, Integer interval)

This method provides data for the first graph (min/max/avg readings for hour or day intervals over the past 24 hours, week or month) via Javascript remoting.  The interval parameter is one of the CHART_XXX values listed in Static Properties.

List<DataRaw> getChartDataRaw(Id channel_id)

This method provides data for the second graph (date/value pairs for past 24 hours) via Javascript remoting.

Static Properties

integer CHART_DAY
integer CHART_WEEK
integer CHART_MONTH

Options passed to getChartData() method to choose between charts grouped by hour for the past day, by day for the past week, or by day for the past month.

String refresh_status

Status string shown to user on GoogleChartDemo.page after readDia() method finishes.

Instance Methods

PageReference readDia()

Connect to iDigi server and check for more Dia Readings for this channel’s device.  Refreshes the charts to display the new readings and updates refresh_status for display on the page.

Instance Properties

HttpResponse testHttpResponse

Property used by automated tests as substitute for XML response from Http.send() call in Dia.loadChannelData().

Back | Next

 

Digi Logo Small Copyright ©2012 Digi International Inc. All rights reserved.
90002179_A