• Skip to content
  • Skip to link menu
KDE 4.0 API Reference
  • KDE API Reference
  • kdeedu
  • Sitemap
  • Contact Us
 

kstars

IU Functions: Functions drivers call to perform handy utility routines.


Detailed Description

This section describes handy utility functions that are provided by the framework for tasks commonly required in the processing of client messages. It is not strictly necessary to use these functions, but it both prudent and efficient to do so.

These do not communicate with the Client in any way.


Functions

IText * IUFindText (const ITextVectorProperty *tp, const char *name)
INumber * IUFindNumber (const INumberVectorProperty *tp, const char *name)
ISwitch * IUFindSwitch (const ISwitchVectorProperty *tp, const char *name)
ISwitch * IUFindOnSwitch (const ISwitchVectorProperty *tp)
void IUResetSwitch (ISwitchVectorProperty *svp)
int IUUpdateSwitch (ISwitchVectorProperty *svp, ISState *states, char *names[], int n)
int IUUpdateNumber (INumberVectorProperty *nvp, double values[], char *names[], int n)
int IUUpdateText (ITextVectorProperty *tvp, char *texts[], char *names[], int n)
void IUUpdateMinMax (const INumberVectorProperty *nvp)
void IUSaveText (IText *tp, const char *newtext)
void IUFillSwitch (ISwitch *sp, const char *name, const char *label, ISState s)
void IUFillLight (ILight *lp, const char *name, const char *label, IPState s)
void IUFillNumber (INumber *np, const char *name, const char *label, const char *format, double min, double max, double step, double value)
void IUFillText (IText *tp, const char *name, const char *label, const char *initialText)
void IUFillSwitchVector (ISwitchVectorProperty *svp, ISwitch *sp, int nsp, const char *dev, const char *name, const char *label, const char *group, IPerm p, ISRule r, double timeout, IPState s)
void IUFillLightVector (ILightVectorProperty *lvp, ILight *lp, int nlp, const char *dev, const char *name, const char *label, const char *group, IPState s)
void IUFillNumberVector (INumberVectorProperty *nvp, INumber *np, int nnp, const char *dev, const char *name, const char *label, const char *group, IPerm p, double timeout, IPState s)
void IUFillTextVector (ITextVectorProperty *tvp, IText *tp, int ntp, const char *dev, const char *name, const char *label, const char *group, IPerm p, double timeout, IPState s)
int IUSnoopNumber (XMLEle *root, INumberVectorProperty *nvp)
int IUSnoopText (XMLEle *root, ITextVectorProperty *tvp)
int IUSnoopLight (XMLEle *root, ILightVectorProperty *lvp)
int IUSnoopSwitch (XMLEle *root, ISwitchVectorProperty *svp)
int IUSnoopBLOB (XMLEle *root, IBLOBVectorProperty *bvp)

Function Documentation

void IUFillLight ( ILight *  lp,
const char *  name,
const char *  label,
IPState  s 
)

Assign attributes for a light property.

The light's auxiliary elements will be set to NULL.

Parameters:
lp pointer a light property to fill
name the light name
label the light label
s the light state (IDLE, WARNING, OK, ALERT)

void IUFillLightVector ( ILightVectorProperty *  lvp,
ILight *  lp,
int  nlp,
const char *  dev,
const char *  name,
const char *  label,
const char *  group,
IPState  s 
)

Assign attributes for a light vector property.

The vector's auxiliary elements will be set to NULL.

Parameters:
lvp pointer a light vector property to fill
lp pointer to an array of lights
nlp the dimension of lp
dev the device name this vector property belongs to
name the vector property name
label the vector property label
group the vector property group
s the vector property initial state.

void IUFillNumber ( INumber *  np,
const char *  name,
const char *  label,
const char *  format,
double  min,
double  max,
double  step,
double  value 
)

Assign attributes for a number property.

The number's auxiliary elements will be set to NULL.

Parameters:
np pointer a number property to fill
name the number name
label the number label
format the number format in printf style (e.g. "%02d")
min the minimum possible value
max the maximum possible value
step the step used to climb from minimum value to maximum value
value the number's current value

void IUFillNumberVector ( INumberVectorProperty *  nvp,
INumber *  np,
int  nnp,
const char *  dev,
const char *  name,
const char *  label,
const char *  group,
IPerm  p,
double  timeout,
IPState  s 
)

Assign attributes for a number vector property.

The vector's auxiliary elements will be set to NULL.

Parameters:
nvp pointer a number vector property to fill
np pointer to an array of numbers
nnp the dimension of np
dev the device name this vector property belongs to
name the vector property name
label the vector property label
group the vector property group
p the vector property permission
timeout vector property timeout in seconds
s the vector property initial state.

void IUFillSwitch ( ISwitch *  sp,
const char *  name,
const char *  label,
ISState  s 
)

Assign attributes for a switch property.

The switch's auxiliary elements will be set to NULL.

Parameters:
sp pointer a switch property to fill
name the switch name
label the switch label
s the switch state (ISS_ON or ISS_OFF)

void IUFillSwitchVector ( ISwitchVectorProperty *  svp,
ISwitch *  sp,
int  nsp,
const char *  dev,
const char *  name,
const char *  label,
const char *  group,
IPerm  p,
ISRule  r,
double  timeout,
IPState  s 
)

Assign attributes for a switch vector property.

The vector's auxiliary elements will be set to NULL.

Parameters:
svp pointer a switch vector property to fill
sp pointer to an array of switches
nsp the dimension of sp
dev the device name this vector property belongs to
name the vector property name
label the vector property label
group the vector property group
p the vector property permission
r the switches behavior
timeout vector property timeout in seconds
s the vector property initial state.

void IUFillText ( IText *  tp,
const char *  name,
const char *  label,
const char *  initialText 
)

Assign attributes for a text property.

The text's auxiliary elements will be set to NULL.

Parameters:
tp pointer a text property to fill
name the text name
label the text label
initialText the initial text

void IUFillTextVector ( ITextVectorProperty *  tvp,
IText *  tp,
int  ntp,
const char *  dev,
const char *  name,
const char *  label,
const char *  group,
IPerm  p,
double  timeout,
IPState  s 
)

Assign attributes for a text vector property.

The vector's auxiliary elements will be set to NULL.

Parameters:
tvp pointer a text vector property to fill
tp pointer to an array of texts
ntp the dimension of tp
dev the device name this vector property belongs to
name the vector property name
label the vector property label
group the vector property group
p the vector property permission
timeout vector property timeout in seconds
s the vector property initial state.

INumber* IUFindNumber ( const INumberVectorProperty *  tp,
const char *  name 
)

Find an INumber member in a number text property.

Parameters:
tp a pointer to a number vector property.
name the name of the member to search for.
Returns:
a pointer to an INumber member on match, or NULL if nothing is found.

ISwitch* IUFindOnSwitch ( const ISwitchVectorProperty *  tp  ) 

Returns the first ON switch it finds in the vector switch property.

Note:
This is only valid for ISR_1OFMANY mode. That is, when only one switch out of many is allowed to be ON. Do not use this function if you can have multiple ON switches in the same vector property.
Parameters:
tp a pointer to a switch vector property.
Returns:
a pointer to the first ON ISwitch member if found. If all switches are off, NULL is returned.

ISwitch* IUFindSwitch ( const ISwitchVectorProperty *  tp,
const char *  name 
)

Find an ISwitch member in a vector switch property.

Parameters:
tp a pointer to a switch vector property.
name the name of the member to search for.
Returns:
a pointer to an ISwitch member on match, or NULL if nothing is found.

IText* IUFindText ( const ITextVectorProperty *  tp,
const char *  name 
)

Find an IText member in a vector text property.

Parameters:
tp a pointer to a text vector property.
name the name of the member to search for.
Returns:
a pointer to an IText member on match, or NULL if nothing is found.

void IUResetSwitch ( ISwitchVectorProperty *  svp  ) 

Reset all switches in a switch vector property to OFF.

Parameters:
svp a pointer to a switch vector property.

void IUSaveText ( IText *  tp,
const char *  newtext 
)

Function to reliably save new text in a IText.

Parameters:
tp pointer to an IText member.
newtext the new text to be saved

int IUSnoopBLOB ( XMLEle *  root,
IBLOBVectorProperty *  bvp 
)

Update a snooped BLOB vector property from the given XML root element.

Parameters:
root XML root elememnt containing the snopped property content
bvp a pointer to the BLOB vector property to be updated.
Returns:
0 if cracking the XML element and updating the property proceeded without errors, -1 if trouble.

int IUSnoopLight ( XMLEle *  root,
ILightVectorProperty *  lvp 
)

Update a snooped light vector property from the given XML root element.

Parameters:
root XML root elememnt containing the snopped property content
lvp a pointer to the light vector property to be updated.
Returns:
0 if cracking the XML element and updating the property proceeded without errors, -1 if trouble.

int IUSnoopNumber ( XMLEle *  root,
INumberVectorProperty *  nvp 
)

Update a snooped number vector property from the given XML root element.

Parameters:
root XML root elememnt containing the snopped property content
nvp a pointer to the number vector property to be updated.
Returns:
0 if cracking the XML element and updating the property proceeded without errors, -1 if trouble.

int IUSnoopSwitch ( XMLEle *  root,
ISwitchVectorProperty *  svp 
)

Update a snooped switch vector property from the given XML root element.

Parameters:
root XML root elememnt containing the snopped property content
svp a pointer to the switch vector property to be updated.
Returns:
0 if cracking the XML element and updating the property proceeded without errors, -1 if trouble.

int IUSnoopText ( XMLEle *  root,
ITextVectorProperty *  tvp 
)

Update a snooped text vector property from the given XML root element.

Parameters:
root XML root elememnt containing the snopped property content
tvp a pointer to the text vector property to be updated.
Returns:
0 if cracking the XML element and updating the property proceeded without errors, -1 if trouble.

void IUUpdateMinMax ( const INumberVectorProperty *  nvp  ) 

Function to update the min and max elements of a number in the client.

Parameters:
nvp pointer to an INumberVectorProperty.

int IUUpdateNumber ( INumberVectorProperty *  nvp,
double  values[],
char *  names[],
int  n 
)

Update all numbers in a number vector property.

Parameters:
nvp a pointer to a number vector property.
values the states of the new INumber members.
names the names of the INumber members to update.
n the number of INumber members to update.
Returns:
0 if update successful, -1 otherwise. Update will fail if values are out of scope, or in case of property name mismatch.

int IUUpdateSwitch ( ISwitchVectorProperty *  svp,
ISState *  states,
char *  names[],
int  n 
)

Update all switches in a switch vector property.

Parameters:
svp a pointer to a switch vector property.
states the states of the new ISwitch members.
names the names of the ISwtich members to update.
n the number of ISwitch members to update.
Returns:
0 if update successful, -1 otherwise.

int IUUpdateText ( ITextVectorProperty *  tvp,
char *  texts[],
char *  names[],
int  n 
)

Update all text members in a text vector property.

Parameters:
tvp a pointer to a text vector property.
texts a pointer to the text members
names the names of the IText members to update.
n the number of IText members to update.
Returns:
0 if update successful, -1 otherwise. Update will fail in case of property name mismatch.

kstars

Skip menu "kstars"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

kdeedu

Skip menu "kdeedu"
  • kalzium
  • kanagram
  • kig
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  •   docs
  •   src
  • parley
Generated for kdeedu by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal