Reference Driver

73M1866B/73M1966B Reference Driver User Guide UG_1x66B_015
60 Rev. 2.7
6.6 Line State Analysis Services
The following services control the FXO line state via line current and line voltage measurements. Table 6
provides the summary of each IOCTL. These IOCTLs can be used for both measuring entities the line
current and line voltage.
Table 6: Line State Analysis Services
Name Description Descriptor
M1966_MEASURE_START
Start line measurement. Channel
M1966_MEASURE_STOP
Stop line measurement. Channel
M1966_MEASURE_UPDATE
Update line measurement parameter (IET). Channel
6.6.1 M1966_MEASURE_START
Description
Starts the measurement of a measuring entity (current or voltage) as specified by its IET parameters. The
param parameter points to a structure that contains the requested measurement criteria.
#define M1966_MEASURE_START _IOWR(0xA4, 0xE5, unsigned int)
Prototype
int ioctl (
int chan_fd,
int M1966_MEASURE_START,
unsigned long param );
Parameters
Data Type Name Description
int
chan_fd
Channel descriptor.
int
M1966_MEASURE_START
I/O control identifier for this operation.
unsigned long param
Pointer to
M1966_MEASURE_START_STOP_t
.
Return Values
Data Type Description
unsigned int
0 – Successful.
-1 Failed to start measurement.
Example
The following example code illustrates the starting of the line current monitoring.
M1966_MEASURE_START_t current;
int ret;
current.entity = M1966_MEASURE_ENTITY_CURRENT; /* start current monitor */
current.sample_time = 100; /* sampling at 100ms interval */
current.average_sample_count = 10; /* averaging over 10 samples */
ret = ioctl (fd, M1966_MEASURE_START, &current);
if (ret < 0)
printf (“Failed to start line current monitoring”);
else
printf (“Successful”);