init
This commit is contained in:
@@ -0,0 +1,380 @@
|
||||
using DbAPI.Connections;
|
||||
using DTS.Common.Interface.Database;
|
||||
using DTS.Common.Interface.Sensors;
|
||||
using DTS.Common.Interface.Sensors.AnalogDiagnostics;
|
||||
using System;
|
||||
|
||||
namespace DbAPI.Sensors
|
||||
{
|
||||
/// <summary>
|
||||
/// Sensor related functions (GetAnalogSensors, InsertUpdateSensor, DeleteSensor)
|
||||
/// </summary>
|
||||
public interface ISensors
|
||||
{
|
||||
/// <summary>
|
||||
/// returns all matching analog diagnostic records
|
||||
/// </summary>
|
||||
/// <param name="user">user making query</param>
|
||||
/// <param name="connection">connection being queried over</param>
|
||||
/// <param name="Id">id of record, or null for all records</param>
|
||||
/// <param name="diagnosticRunId">id of diagnostic run, or null for all records</param>
|
||||
/// <param name="sensorId">sensor id to query for, or null for all</param>
|
||||
/// <param name="sensorSerialNumber">serial number to query for, or null for all</param>
|
||||
/// <returns></returns>
|
||||
ulong SensorsAnalogDiagnosticsGet(IUserDbRecord user, IConnectionDetails connection,
|
||||
long? Id, long? diagnosticRunId, int? sensorId, string sensorSerialNumber, out IDiagnosticEntry [] records);
|
||||
/// <summary>
|
||||
/// retrieves any matching
|
||||
/// </summary>
|
||||
/// <param name="user">user making query</param>
|
||||
/// <param name="Id">diagnostic run id to query for or null for any id</param>
|
||||
/// <param name="testId">test setup id to query for or null for any id</param>
|
||||
/// <param name="testName">test setup name to query for or null for any name</param>
|
||||
/// <param name="connection">connection to query on</param>
|
||||
/// <param name="records">out records</param>
|
||||
/// <returns>0 (ERROR_SUCCESS) on success, all other values are error codes</returns>
|
||||
ulong SensorsAnalogDiagnosticRunGet(IUserDbRecord user, IConnectionDetails connection,
|
||||
long? Id, int? testId, string testName, out IDiagnosticRun [] records);
|
||||
|
||||
/// <summary>
|
||||
/// update or inserts all entries passed in
|
||||
/// </summary>
|
||||
/// <param name="user">user committing entries</param>
|
||||
/// <param name="connection">connection to commit over</param>
|
||||
/// <param name="entries">entries to insert or update</param>
|
||||
/// <returns>0 (ERROR_SUCCESS) on success, all other values are error codes</returns>
|
||||
ulong SensorsAnalogDiagnosticUpdateInsert(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
ref IDiagnosticEntry entry);
|
||||
/// <summary>
|
||||
/// updates or inserts a Diagnostic run into the database
|
||||
/// </summary>
|
||||
/// <param name="user">user committing record</param>
|
||||
/// <param name="connection">connection diagnostic run is being committed over</param>
|
||||
/// <param name="run">the record to insert or update</param>
|
||||
/// <returns>0 (ERROR_SUCCESS) on success, all other values are error codes</returns>
|
||||
ulong SensorsAnalogDiagnosticRunUpdateInsert(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
ref IDiagnosticRun run);
|
||||
/// <summary>
|
||||
/// updates or inserts an input stream record into the database
|
||||
/// Database id is modified on record on an insert operation
|
||||
/// </summary>
|
||||
/// <param name="user">user committing record</param>
|
||||
/// <param name="connection">connection record is being committed over</param>
|
||||
/// <param name="record">record to be inserted or updated</param>
|
||||
/// <returns>0 (ERROR_SUCCESS) on success, all other values are error codes</returns>
|
||||
ulong SensorsInputStreamUpdateInsert(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
ref IStreamInputRecord record);
|
||||
/// <summary>
|
||||
/// retrieves matching input streams from database
|
||||
/// </summary>
|
||||
/// <param name="user">user making request</param>
|
||||
/// <param name="connection">connection over which to look for records</param>
|
||||
/// <param name="Id">database id of record (use null for all)</param>
|
||||
/// <param name="SerialNumber">serial number of record (use null for all)</param>
|
||||
/// <param name="records">all matching records</param>
|
||||
/// <returns>0 (ERROR_SUCCESS) on success, all other values are error codes</returns>
|
||||
ulong SensorsInputStreamGet(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
int? Id,
|
||||
string SerialNumber,
|
||||
out IStreamInputRecord[] records);
|
||||
/// <summary>
|
||||
/// retrieves matching thermocouplers from database
|
||||
/// </summary>
|
||||
/// <param name="user">user making request</param>
|
||||
/// <param name="connection">connection over which to look for records</param>
|
||||
/// <param name="Id">database id of record (use null for all)</param>
|
||||
/// <param name="SerialNumber">serial number of record (use null for all)</param>
|
||||
/// <param name="records">all matching records</param>
|
||||
/// <returns>0 (ERROR_SUCCESS) on success, all other values are error codes</returns>
|
||||
ulong SensorsThermocouplerGet(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
int clientDbVersion,
|
||||
int? Id,
|
||||
string SerialNumber,
|
||||
out IThermocouplerRecord[] records);
|
||||
/// <summary>
|
||||
/// updates or inserts an output stream record into the database
|
||||
/// Database id is modified on record on an insert operation
|
||||
/// </summary>
|
||||
/// <param name="user">user committing record</param>
|
||||
/// <param name="connection">connection record is being committed over</param>
|
||||
/// <param name="record">record to be inserted or updated</param>
|
||||
/// <returns>0 (ERROR_SUCCESS) on success, all other values are error codes</returns>
|
||||
ulong SensorsOutputStreamUpdateInsert(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
ref IStreamOutputRecord record);
|
||||
/// <summary>
|
||||
/// retrieves matching output streams from database
|
||||
/// </summary>
|
||||
/// <param name="user">user making request</param>
|
||||
/// <param name="connection">connection over which to look for records</param>
|
||||
/// <param name="Id">database id of record (use null for all)</param>
|
||||
/// <param name="SerialNumber">serial number of record (use null for all)</param>
|
||||
/// <param name="records">all matching records</param>
|
||||
/// <returns>0 (ERROR_SUCCESS) on success, all other values are error codes</returns>
|
||||
ulong SensorsOutputStreamGet(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
int? Id,
|
||||
string SerialNumber,
|
||||
out IStreamOutputRecord[] records);
|
||||
/// <summary>
|
||||
/// updates or inserts a new UART record into the database
|
||||
/// Id is updated if a new record is inserted
|
||||
/// </summary>
|
||||
/// <param name="user">user committing UART</param>
|
||||
/// <param name="connection">connection UART should be committed on</param>
|
||||
/// <param name="record">record being inserted or updated</param>
|
||||
/// <returns>0 (ERROR_SUCCESS) on success, all other values are error codes</returns>
|
||||
ulong SensorsUARTUpdateInsert(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
ref IUARTRecord record);
|
||||
/// <summary>
|
||||
/// retrieves UART settings
|
||||
/// </summary>
|
||||
/// <param name="user">user making requests</param>
|
||||
/// <param name="connection">connection request sh</param>
|
||||
/// <param name="Id">Id to search for (use null for all)</param>
|
||||
/// <param name="SerialNumber">serial number to search for (use null or empty for all)</param>
|
||||
/// <param name="records">matching records found</param>
|
||||
/// <returns>0 (ERROR_SUCCESS) on success, all other values are error codes</returns>
|
||||
ulong SensorsUARTGet(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
int? Id,
|
||||
string SerialNumber,
|
||||
out IUARTRecord[] records);
|
||||
/// <summary>
|
||||
/// commits a digital output setting to the db
|
||||
/// The record will be modified with a new database id if
|
||||
/// a new record is inserted
|
||||
/// </summary>
|
||||
/// <param name="user">user making commit</param>
|
||||
/// <param name="connection">connection over which to commit</param>
|
||||
/// <param name="record">the record to commit</param>
|
||||
/// <returns>0 (ERROR_SUCCESS) on success, all other values are error codes</returns>
|
||||
ulong SensorsDigitalOutUpdateInsert(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
IDigitalOutDbRecord record);
|
||||
/// <summary>
|
||||
/// retrieves all matching digital output settings in the db
|
||||
/// </summary>
|
||||
/// <param name="user">user requesting records</param>
|
||||
/// <param name="connection">connection to query records on</param>
|
||||
/// <param name="Id">Database id of records (can be null)</param>
|
||||
/// <param name="serialNumber">serial number/name of setting (can be null)</param>
|
||||
/// <param name="records">all matching records</param>
|
||||
/// <returns>0 (ERROR_SUCCESS) on success, all other values are error codes</returns>
|
||||
ulong SensorsDigitalOutGet(
|
||||
IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
int? Id,
|
||||
string serialNumber,
|
||||
out IDigitalOutDbRecord[] records);
|
||||
/// <summary>
|
||||
/// inserts or updates a digital input record into the db. If a record is inserted
|
||||
/// then the original record is updated with the database id of the entry
|
||||
/// </summary>
|
||||
/// <param name="user">user committing record </param>
|
||||
/// <param name="connection"></param>
|
||||
/// <param name="record"></param>
|
||||
/// <returns></returns>
|
||||
ulong SensorsDigitalInUpdateInsert(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
IDigitalInDbRecord record);
|
||||
/// <summary>
|
||||
/// retrieves any digital input settings matching input criteria
|
||||
/// in the database
|
||||
/// </summary>
|
||||
/// <param name="user">user making request</param>
|
||||
/// <param name="connection">connection to query over</param>
|
||||
/// <param name="id">Database Id of digital input setting (can be null)</param>
|
||||
/// <param name="serialNumber">serial number of setting (can be null)</param>
|
||||
/// <param name="eId">Electronic id of setting (can be null)</param>
|
||||
/// <param name="records">all matching records</param>
|
||||
/// <returns>0 (ERROR_SUCCESS) on success, all other values are errors</returns>
|
||||
ulong SensorsDigitalInGet(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
int? id,
|
||||
string serialNumber,
|
||||
string eId,
|
||||
out IDigitalInDbRecord[] records);
|
||||
/// <summary>
|
||||
/// Inserts or updates a squib setting in the db
|
||||
/// setting is modified with new db id after execution
|
||||
/// </summary>
|
||||
/// <param name="user">user inserting setting</param>
|
||||
/// <param name="connection">connection for inserting</param>
|
||||
/// <param name="record">record to be inserted</param>
|
||||
/// <returns>0 (ERROR_SUCCESS) on success, all other values are error codes</returns>
|
||||
ulong SensorsSquibUpdateInsert(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
ISquibDbRecord record);
|
||||
/// <summary>
|
||||
/// retrieves all squib settings matching input criteria
|
||||
/// </summary>
|
||||
/// <param name="user">user requesting squib settings</param>
|
||||
/// <param name="connection">connection for retrieving squib settings</param>
|
||||
/// <param name="eId">Electronic Id </param>
|
||||
/// <param name="Id">Database Id for squib setting</param>
|
||||
/// <param name="serialNumber">serial number/name of squib setting</param>
|
||||
/// <param name="records">output records discovered</param>
|
||||
/// <returns>0 (ERROR_SUCCESS) on success, all other values are errors</returns>
|
||||
ulong SensorsSquibGet(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
int? Id,
|
||||
string serialNumber,
|
||||
string eId,
|
||||
out ISquibDbRecord[] records);
|
||||
/// <summary>
|
||||
/// Deletes ALL sensors in the db
|
||||
/// </summary>
|
||||
/// <param name="user">user deleting sensors</param>
|
||||
/// <param name="connection">connection sensors to be deleted on</param>
|
||||
/// <returns>0 (ERROR_SUCCESS) on success, all other values are errors</returns>
|
||||
ulong SensorsDeleteAll(IUserDbRecord user,
|
||||
IConnectionDetails connection);
|
||||
/// <summary>
|
||||
/// retrieves the bridge resistance for a sensor
|
||||
/// </summary>
|
||||
/// <param name="user">user making query</param>
|
||||
/// <param name="connection">connection query is being made on</param>
|
||||
/// <param name="serialNumber">serial number of sensor</param>
|
||||
/// <param name="bridgeResistance">output bridge resistance of sensor</param>
|
||||
/// <returns>0 (ERROR_SUCCESS) on success, all other values are error codes</returns>
|
||||
ulong SensorsAnalogBridgeResistanceGet(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
string serialNumber,
|
||||
out double bridgeResistance);
|
||||
/// <summary>
|
||||
/// deletes all sensor calibrations matching criteria
|
||||
/// nulls are wild cards, so passing in all nulls will
|
||||
/// delete all calibrations
|
||||
/// </summary>
|
||||
/// <param name="user">user deleting calibrations</param>
|
||||
/// <param name="connection">connection to use for deletes</param>
|
||||
/// <param name="sensorSerialNumber">allows null</param>
|
||||
/// <param name="calibrationDate">allows null</param>
|
||||
/// <param name="modifyDate">allows null</param>
|
||||
/// <returns>0 (ERROR_SUCCESS) on success, all other values are errors</returns>
|
||||
ulong SensorCalibrationsDelete(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
string sensorSerialNumber,
|
||||
DateTime? calibrationDate,
|
||||
DateTime? modifyDate
|
||||
);
|
||||
/// <summary>
|
||||
/// inserts a new calibration record
|
||||
/// </summary>
|
||||
/// <param name="user">user submitting record</param>
|
||||
/// <param name="connection">connection record is being submitted on</param>
|
||||
/// <param name="cal">calibration record</param>
|
||||
/// <param name="sensorType">type of sensor</param>
|
||||
/// <param name="setCalibrationId"></param>
|
||||
/// <returns>0 (ERROR_SUCCESS) on success, all other values are error codes</returns>
|
||||
ulong SensorCalibrationsInsert(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
ISensorCalDbRecord cal,
|
||||
int sensorType,
|
||||
bool setCalibrationId);
|
||||
/// <summary>
|
||||
/// deletes all sensors matching criteria
|
||||
/// sensor types are defined in table SensorsType
|
||||
/// 0 - analog
|
||||
/// 1 - digital in
|
||||
/// 2 - digital out
|
||||
/// 3 - squib
|
||||
/// 4 - UART
|
||||
/// </summary>
|
||||
/// <param name="user">user deleting sensors</param>
|
||||
/// <param name="connection">connection sensors are being deleted on</param>
|
||||
/// <param name="sensorId">id in database</param>
|
||||
/// <param name="sensorType">type of sensor</param>
|
||||
/// <returns>0 (ERROR_SUCCESS) on success, all other values are errors</returns>
|
||||
ulong SensorsDelete(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
int sensorId,
|
||||
int sensorType);
|
||||
/// <summary>
|
||||
/// commits an analog sensor to the db
|
||||
/// </summary>
|
||||
/// <param name="user">DataPRO user making commit</param>
|
||||
/// <param name="connection">connection commit is being made on</param>
|
||||
/// <param name="record">the record being committed</param>
|
||||
/// <returns>0 (ERROR_SUCCESS) on success, all other values are error codes</returns>
|
||||
ulong SensorsAnalogUpdateInsert(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
IAnalogDbRecord record);
|
||||
/// <summary>
|
||||
/// retrieves all calibrations matching search criteria
|
||||
/// </summary>
|
||||
/// <param name="user">user querying calibrations</param>
|
||||
/// <param name="connection">connection user is using</param>
|
||||
/// <param name="sensorId">sensor id (allows null)</param>
|
||||
/// <param name="serialNumber">serial number (allows null and empty)</param>
|
||||
/// <param name="calibrations">any calibrations matching criteria</param>
|
||||
/// <returns>0 (ERROR_SUCCESS) on success, all other values are error codes</returns>
|
||||
ulong SensorCalibrationsGet(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
int? sensorId,
|
||||
string serialNumber,
|
||||
out ISensorCalDbRecord[] calibrations
|
||||
);
|
||||
/// <summary>
|
||||
/// retrieves all analog sensors matching search criteria
|
||||
/// </summary>
|
||||
/// <param name="user">user querying sensors</param>
|
||||
/// <param name="connection">connection is using</param>
|
||||
/// <param name="sensorId">sensor database id (allows null)</param>
|
||||
/// <param name="serialNumber">sensor serial number (allows null)</param>
|
||||
/// <param name="eId">electronic Id (DALLAS or TEDS id value)</param>
|
||||
/// <param name="sensors">any sensors matching criteria</param>
|
||||
/// <returns>0 (ERROR_SUCCES) on success, all other values are error codes</returns>
|
||||
ulong SensorsAnalogGet(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
int? sensorId,
|
||||
string serialNumber,
|
||||
string eId,
|
||||
out IAnalogDbRecord[] sensors);
|
||||
/// <summary>
|
||||
/// retrieves all analog sensors matching search criteria
|
||||
/// </summary>
|
||||
/// <param name="user">user querying sensors</param>
|
||||
/// <param name="connection">connection is using</param>
|
||||
/// <param name="serialNumber">sensor serial number (allows null)</param>
|
||||
/// <param name="sensors">any sensors matching criteria</param>
|
||||
/// <returns>0 (ERROR_SUCCES) on success, all other values are error codes</returns>
|
||||
ulong SensorsGet(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
string serialNumber,
|
||||
out ISensorDbRecord[] sensors);
|
||||
ulong UpdateAssemblySensorUsageCount(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
string assemblyName,
|
||||
int newUsageCount);
|
||||
/// <summary>
|
||||
/// Updates a sensor's (total) usage count
|
||||
/// </summary>
|
||||
/// <param name="user">user querying sensors</param>
|
||||
/// <param name="connection">connection is using</param>
|
||||
/// <param name="sd">The sensor to be updated</param>
|
||||
/// <returns></returns>
|
||||
ulong UpdateSensorUsageCount(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
ISensorData sd);
|
||||
/// <summary>
|
||||
/// Updates a sensor calibration's usage count
|
||||
/// </summary>
|
||||
/// <param name="user">user querying sensors</param>
|
||||
/// <param name="connection">connection is using</param>
|
||||
/// <param name="sd">The sensor to be updated</param>
|
||||
/// <returns></returns>
|
||||
ulong UpdateSensorCalibrationUsageCount(IUserDbRecord user,
|
||||
IConnectionDetails connection,
|
||||
int sensorId,
|
||||
int sensorCalibrationId,
|
||||
int newUsageCount);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user