C# Class OpenHome.Net.Device.DvProvider

Base class for a service provider.
Derivations will typically be by service-specific auto-generated code which will offer 0..n actions and 0..n properties.
Mostrar archivo Open project: openhome/ohNet

Protected Properties

Property Type Description
iHandle System.IntPtr

Public Methods

Method Description
PropertiesLock ( ) : void

Lock the provider's properties, blocking publication of updates.

This is not necessary when updating a single property but is used by providers that have >1 properties whose values are related. Without locking, updates to some properties may be published, leaving related properties in their old (now incompatible) states. Every call to this must be followed by (exactly) one call to PropertiesUnlock().

PropertiesUnlock ( ) : void

Unlock the provider's properties, allowing publication of updates.

Any pending updates will automatically be scheduled. This must only be called following a call to PropertiesLock().

Protected Methods

Method Description
AddProperty ( OpenHome aProperty ) : void

Add a property to this provider

Any later updates to the value of the property will be automatically published to any subscribers

DisposeProvider ( ) : bool

Must be called by each sub-class, preferably from their Dispose() method

DvProvider ( OpenHome.Net.Device.DvDevice aDevice, String aDomain, String aType, uint aVersion ) : System

Constructor

EnableAction ( OpenHome aAction, ActionDelegate aDelegate, IntPtr aPtr ) : void

Register an action as available. The action will be published as part of the owning device's service xml

SetPropertyBinary ( PropertyBinary aProperty, byte aValue ) : bool

Utility function which updates the value of a PropertyBinary. (Not intended for external use)

If the property value has changed and the properties are not locked (PropertiesLock() called more recently than PropertiesUnlock()), publication of an update is scheduled

SetPropertyBool ( PropertyBool aProperty, bool aValue ) : bool

Utility function which updates the value of a PropertyBool. (Not intended for external use)

If the property value has changed and the properties are not locked (PropertiesLock() called more recently than PropertiesUnlock()), publication of an update is scheduled

SetPropertyInt ( PropertyInt aProperty, int aValue ) : bool

Utility function which updates the value of a PropertyInt. (Not intended for external use)

If the property value has changed and the properties are not locked (PropertiesLock() called more recently than PropertiesUnlock()), publication of an update is scheduled. Throws ParameterValidationError if the property has a range of allowed values and the new value is not in this range

SetPropertyString ( PropertyString aProperty, String aValue ) : bool

Utility function which updates the value of a PropertyString. (Not intended for external use)

If the property value has changed and the properties are not locked (PropertiesLock() called more recently than PropertiesUnlock()), publication of an update is scheduled. Throws ParameterValidationError if the property has a range of allowed values and the new value is not in this range

SetPropertyUint ( PropertyUint aProperty, uint aValue ) : bool

Utility function which updates the value of a PropertyUint. (Not intended for external use)

If the property value has changed and the properties are not locked (PropertiesLock() called more recently than PropertiesUnlock()), publication of an update is scheduled. Throws ParameterValidationError if the property has a range of allowed values and the new value is not in this range

Private Methods

Method Description
DvProviderAddAction ( IntPtr aProvider, IntPtr aAction, ActionDelegate aCallback, IntPtr aPtr ) : void
DvProviderAddProperty ( IntPtr aProvider, IntPtr aProperty ) : void
DvProviderCreate ( IntPtr aDevice, IntPtr aDomain, IntPtr aType, uint aVersion ) : IntPtr
DvProviderDestroy ( IntPtr aProvider ) : void
DvProviderPropertiesLock ( IntPtr aHandle ) : void
DvProviderPropertiesUnlock ( IntPtr aHandle ) : void
DvProviderSetPropertyBinary ( IntPtr aProvider, IntPtr aProperty, IntPtr aData, uint aLen, uint &aChanged ) : int
DvProviderSetPropertyBool ( IntPtr aProvider, IntPtr aProperty, uint aValue, uint &aChanged ) : int
DvProviderSetPropertyInt ( IntPtr aProvider, IntPtr aProperty, int aValue, uint &aChanged ) : int
DvProviderSetPropertyString ( IntPtr aProvider, IntPtr aProperty, IntPtr aValue, uint &aChanged ) : int
DvProviderSetPropertyUint ( IntPtr aProvider, IntPtr aProperty, uint aValue, uint &aChanged ) : int

Method Details

AddProperty() protected method

Add a property to this provider
Any later updates to the value of the property will be automatically published to any subscribers
protected AddProperty ( OpenHome aProperty ) : void
aProperty OpenHome Property being added
return void

DisposeProvider() protected method

Must be called by each sub-class, preferably from their Dispose() method
protected DisposeProvider ( ) : bool
return bool

DvProvider() protected method

Constructor
protected DvProvider ( OpenHome.Net.Device.DvDevice aDevice, String aDomain, String aType, uint aVersion ) : System
aDevice OpenHome.Net.Device.DvDevice Device the service is being added to and will be offered by
aDomain String Domain of the vendor who defined the service
aType String Name of the service
aVersion uint Version number of the service
return System

EnableAction() protected method

Register an action as available. The action will be published as part of the owning device's service xml
protected EnableAction ( OpenHome aAction, ActionDelegate aDelegate, IntPtr aPtr ) : void
aAction OpenHome Action being registered as availabke
aDelegate ActionDelegate Delegate to call when the action is invoked
aPtr System.IntPtr Data to pass to the delegate
return void

PropertiesLock() public method

Lock the provider's properties, blocking publication of updates.
This is not necessary when updating a single property but is used by providers that have >1 properties whose values are related. Without locking, updates to some properties may be published, leaving related properties in their old (now incompatible) states. Every call to this must be followed by (exactly) one call to PropertiesUnlock().
public PropertiesLock ( ) : void
return void

PropertiesUnlock() public method

Unlock the provider's properties, allowing publication of updates.
Any pending updates will automatically be scheduled. This must only be called following a call to PropertiesLock().
public PropertiesUnlock ( ) : void
return void

SetPropertyBinary() protected method

Utility function which updates the value of a PropertyBinary. (Not intended for external use)
If the property value has changed and the properties are not locked (PropertiesLock() called more recently than PropertiesUnlock()), publication of an update is scheduled
protected SetPropertyBinary ( PropertyBinary aProperty, byte aValue ) : bool
aProperty OpenHome.Net.Core.PropertyBinary Property to be updated
aValue byte New value for the property
return bool

SetPropertyBool() protected method

Utility function which updates the value of a PropertyBool. (Not intended for external use)
If the property value has changed and the properties are not locked (PropertiesLock() called more recently than PropertiesUnlock()), publication of an update is scheduled
protected SetPropertyBool ( PropertyBool aProperty, bool aValue ) : bool
aProperty OpenHome.Net.Core.PropertyBool Property to be updated
aValue bool New value for the property
return bool

SetPropertyInt() protected method

Utility function which updates the value of a PropertyInt. (Not intended for external use)
If the property value has changed and the properties are not locked (PropertiesLock() called more recently than PropertiesUnlock()), publication of an update is scheduled. Throws ParameterValidationError if the property has a range of allowed values and the new value is not in this range
protected SetPropertyInt ( PropertyInt aProperty, int aValue ) : bool
aProperty OpenHome.Net.Core.PropertyInt Property to be updated
aValue int New value for the property
return bool

SetPropertyString() protected method

Utility function which updates the value of a PropertyString. (Not intended for external use)
If the property value has changed and the properties are not locked (PropertiesLock() called more recently than PropertiesUnlock()), publication of an update is scheduled. Throws ParameterValidationError if the property has a range of allowed values and the new value is not in this range
protected SetPropertyString ( PropertyString aProperty, String aValue ) : bool
aProperty OpenHome.Net.Core.PropertyString Property to be updated
aValue String New value for the property
return bool

SetPropertyUint() protected method

Utility function which updates the value of a PropertyUint. (Not intended for external use)
If the property value has changed and the properties are not locked (PropertiesLock() called more recently than PropertiesUnlock()), publication of an update is scheduled. Throws ParameterValidationError if the property has a range of allowed values and the new value is not in this range
protected SetPropertyUint ( PropertyUint aProperty, uint aValue ) : bool
aProperty OpenHome.Net.Core.PropertyUint Property to be updated
aValue uint New value for the property
return bool

Property Details

iHandle protected_oe property

protected IntPtr,System iHandle
return System.IntPtr