Click or drag to resize

FusionStaticAsset Class

StaticAsset asset class for Crestron FusionRoom

This class will trigger FusionAssetStateChange event.

Inheritance Hierarchy
SystemObject
  Crestron.SimplSharpPro.FusionFusionAssetBase
    Crestron.SimplSharpPro.FusionFusionStaticAsset

Namespace: Crestron.SimplSharpPro.Fusion
Assembly: Crestron.SimplSharpPro.Fusion (in Crestron.SimplSharpPro.Fusion.dll) Version: 2.21.121
Syntax
C#
public sealed class FusionStaticAsset : FusionAssetBase

The FusionStaticAsset type exposes the following members.

Properties
 NameDescription
Public propertyAssetError Property to return the AssetError sig details. The AssetError has only input sig and is used to send error data to Fusion.
Public propertyAssetUsage Property to return the AssetUsage sig details. The AssetUsage has only input sig and is used to send asset usage data to Fusion.
Public propertyConnected Property to return the Connected sig details. The Connected has only input sig and is used to send notification to Fusion that the device is connected to the control processor.
Public propertyOwner Returns the FusionRoom or FusionNode that the asset belongs to.
(Inherited from FusionAssetBase)
Public propertyParamAssetName Parameter to access the name of the asset of FusionBase Device as it will be displayed in FusionBase.
(Inherited from FusionAssetBase)
Public propertyParamAssetNumber Parameter to access the user defined number of the asset of FusionBase Device.
(Inherited from FusionAssetBase)
Public propertyParamAssetType Parameter to access the user defined name of the asset type FusionBase Device asset. This parameter is read-only field used by FusionBase that cannot be edited, except for FusionDynamicAsset and FusionStaticAsset assets. User can define the name of the asset type only for FusionDynamicAsset and FusionStaticAsset assets of FusionBase Device.
(Inherited from FusionAssetBase)
Public propertyParamInstanceID Parameter to access the user defined Instance ID of the asset of FusionBase Device which is read-only field used by FusionBase that cannot be edited.
(Inherited from FusionAssetBase)
Public propertyParamMake Parameter to access optional text field that identifies the make of the device of the FusionStaticAsset.
Public propertyParamModel Parameter to access optional text field that identifies the model of the device of the FusionStaticAsset.
Public propertyPowerOff Property to return the PowerOff sig details. The PowerOff has only output sig and is used to indicate that Fusion is turning the power off.

The FusionAssetStateChange event will trigger with StaticAssetPowerOffReceivedEventId.

Public propertyPowerOn Property to return the PowerOn sig details. The PowerOn has both input and output sigs. Input sig is used to send notification to Fusion that the device power is on and the output sig is used to indicate that Fusion is turning the power on.

The FusionAssetStateChange event will trigger with StaticAssetPowerOnReceivedEventId.

Top
Methods
 NameDescription
Public methodAddSig Method to add user configurable sig to the corresponding collection. This will override any previous configuration for the specified number. The valid sig numbers are from 1 to 24951 for FusionGenericAssetSerialsAsset3 and FusionGenericAssetDigitalsAsset1 and FusionGenericAssetAnalogsAsset2
Public methodEqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
Public methodGetHashCodeServes as the default hash function.
(Inherited from Object)
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Public methodRemoveAllSigs Method to remove all user configured sigs of predefined assets from all the collections.
Public methodRemoveSig Method to remove user configured sig from the corresponding collection. Both input and output sigs corresponding to the sig number passed will be removed. The valid sig numbers are from 1 to 24951 for FusionGenericAssetSerialsAsset3 and FusionGenericAssetDigitalsAsset1 and FusionGenericAssetAnalogsAsset2
Public methodToStringReturns a string that represents the current object.
(Inherited from Object)
Top
Fields
 NameDescription
Public fieldFusionGenericAssetAnalogsAsset2FusionStaticAssetFusionGenericAssetAnalogs for Crestron FusionRoom.

The FusionAssetStateChange event will trigger with StaticAssetAssetUshortAssetSigEventReceivedEventId for FusionStaticAssetFusionGenericAssetAnalogs Output Sig value changes.

Public fieldFusionGenericAssetDigitalsAsset1FusionStaticAssetFusionGenericAssetDigitals for Crestron FusionRoom.

The FusionAssetStateChange event will trigger with StaticAssetAssetBoolAssetSigEventReceivedEventId for FusionStaticAssetFusionGenericAssetDigitals Output Sig state changes.

Public fieldFusionGenericAssetSerialsAsset3FusionStaticAssetFusionGenericAssetSerials for Crestron FusionRoom.

The FusionAssetStateChange event will trigger with StaticAssetAssetStringAssetSigEventReceivedEventId for FusionStaticAssetFusionGenericAssetSerials Output Sig value changes.

Public fieldPredefinedBooleanSigDetailsBooleanSigDataFixedName collection for Predefined Boolean Sig details for FusionStaticAsset of FusionRoom.

The FusionAssetStateChange event will trigger with FusionAssetEventId for Predefined Bool Output Sig state changes.

Public fieldPredefinedStringSigDetailsStringSigDataFixedName collection for Predefined String Sig details for FusionStaticAsset of FusionRoom.

The FusionAssetStateChange event will trigger with FusionAssetEventId for Predefined String Output Sig value changes.

Top
Example
C#
/// Add our assets to the Fusion room. Each Asset can be a variety of types 
/// For more info on each asset type, go to Fusion's SSI guide.
/// Assets store information about each devices.
/// For most use casses, static assets will be used.
/// See FusionRoom example for initialization steps.
private static bool addAsset(FusionRoom room)
{
    bool returnValue = false;

    try
    {
        // IMPORTANT: when adding assets, the instance id must be unique, if it is not
        // fusion will override the old asset with the most recent asset with the same ID.  

        // Add an asset to the room with the type Static asset, with the type of Display.
        room.AddAsset(eAssetType.StaticAsset, _displayId, "mainDisplay", "Display", "0005");

        //return the status of the function's execution.
        returnValue = true;
    }
    catch (Exception e)
    {
        ErrorLog.Error("Error while creating Asset: {0}, {1}", e.Message.ToString(), e.StackTrace);

        // Flag our return value as false since execution has reached the exception block.
        returnValue = false;
    }

    // Return the boolean indicating the success of the function's execution.
    return returnValue;
}

// Returns a FusionStaticAsset object if type casting is successful.
// If not then null is returned.
public static FusionStaticAsset GetDisplay(FusionRoom room)
{        
       try
       {
           // Type casting the Asset baseClass to the StaticAsset class
           // as that is what was specified on time of creation.
           return room.UserConfigurableAssetDetails[_displayId].Asset as FusionStaticAsset;
       }
       catch (Exception e)
       {
           ErrorLog.Error("Error while trying to return FusionAsset at index: {0}", _displayId, e.StackTrace);
       }

       return null;
}

// Tracks the usage while device is detected as online.
// These are called within other functions in the example.
// However, call them at your discretion as there are multiple scenarios where
// it would be a good idea to log device's usage time.
public static void DisplayDeviceUsage(FusionRoom room, DateTime displayStartTime)
{
    // Subtract the time the device came online from the current time.
    TimeSpan elapsedTime = CrestronEnvironment.GetLocalTime().Subtract(displayStartTime);

    // Report how long the display was used to Fusion.
    // for Display usage tracking.
    room.DisplayUsage.InputSig.UShortValue += (ushort)elapsedTime.TotalHours;

    // If the room is object is not initialized or the elapsed time is less than 1 minute 
    // Don't send usage data.
    if (room != null && (int)elapsedTime.TotalHours > 0)
    {
        // Construct the time stamp that will be send over to Fusion.    
        string time = elapsedTime.Hours + ":" + elapsedTime.Minutes + ":" + elapsedTime.Seconds;

        // Log some information about the usage to the control system.
        ErrorLog.Notice("Time: {0}", time);
        ErrorLog.Notice("Total elapsed hours: {0}", (int)elapsedTime.TotalHours);

        // Construct the date stamp that will be sent over to Fusion.
        string date = DateTime.Now.Year + "-" + DateTime.Now.Month + "-" + DateTime.Now.Day;

        // Construct the data that will be sent over to Fusion.
        room.DeviceUsage.InputSig.StringValue = "USAGE||" + date + "||" + time + "||TIME||DISPLAY||mainDisplay||-||" + (int)elapsedTime.TotalHours + "||-||-||-||";
    }
    else
    {
        ErrorLog.Notice("Time active too small to track for display.");
    }
}

Version Information

.NET

Supported in: 6.0

.NET Compact Framework

Supported in: 3.5
See Also