Cisco Packet Tracer Extensions API 8.1.0
API for communication between Cisco Packet Tracer application and its extension applications and modules.
Public Member Functions | List of all members
Environment Class Reference

An object in the Physical Workspace. More...

Public Member Functions

void pauseTime ()
 Pauses the environment time. More...
 
void resumeTime ()
 Resumes the environment time. More...
 
bool isTimeRunning ()
 Returns true if the environment time is running, false if paused. More...
 
int getTimeInSeconds ()
 Returns the current environment runtime, in seconds. The value loops, so after 24 hours it resets to 0. More...
 
void setTimeInSeconds (int)
 Sets the current environment time to the given time, in seconds. Time loops every 24 hours. More...
 
float getTimeMultiplier ()
 Multiplier used when calculating how much environment time passes each step, in seconds. More...
 
void setTimeMultiplier (float)
 Sets the multiplier used when calculating how much environment time passes each step, in seconds. More...
 
int getKeyframeCount ()
 How many key frames are in the environment. More...
 
EnvironmentKeyframe getKeyframeAt (int)
 How Returns a keyframe at a specified index. More...
 
EnvironmentKeyframe addKeyframe (int)
 Adds a keyframe at the specified time and returns the new keyframe. More...
 
bool hasKeyframeAtTime (int)
 Returns if there is a keyframe at the given time. More...
 
int getKeyframeIndexAtTime (int)
 Returns the index of a keyframe at the given time if one exists. More...
 
EnvironmentKeyframe getStagingKeyframe ()
 Returns the staging keyframe. More...
 
int addKeyframeFromStaging ()
 Adds a keyframe from staging. More...
 
void removeKeyframe (int)
 Removes the keyframe at the given index if the keyframe exists and isn't the start or end. More...
 
int getEnvironmentOptionsCount ()
 
EnvironmentOptions getEnvironment (QString)
 Returns the options for a specified environment value type, like "CO" for carbon monoxide. More...
 
vector< QString > getEnvironmentKeys ()
 Returns a list of all the environment value types. More...
 
float getEnvironmentValue (QString)
 Returns the value for the specified environment property. More...
 
QString getUnit (QString)
 Returns the unit used for the specified environment property. More...
 
QString getValueWithUnit (QString)
 Returns a string combining the specified environment property and the display unit is uses. More...
 
float getMetricValue (QString)
 Returns the metric value for the given environment value. More...
 
void setCurrentKeyTime (int)
 
void setNextKeyTime (int)
 
void setEditMode (bool)
 
bool isEditMode ()
 Returns true if the environment editor window is in Edit mode. More...
 
void exportToFile ()
 Starts the process for saving the environment window values to an xml file. More...
 
void importFromFile ()
 Starts the save process for importing the environment window values from an xml file. More...
 
void setAllActive (QString, bool)
 Goes through all keyframes and staging keyframes and looks for keyframes with the given environment value type and sets them active/inactive. More...
 
void setKeyframeActive (int, QString, bool)
 Sets the specified keyframe to active and the environment value in it to be active. More...
 
void setAllShow (QString, bool)
 Goes through all keyframes and staging keyframes and looks for keyframes with the given environment value type and sets the stored value for show. More...
 
void setAllTransference (QString, float)
 Goes through all keyframes and staging keyframes and looks for keyframes with the given environment value type and sets the stored value for transference. More...
 
void setAllInterpolate (QString, bool)
 Goes through all keyframes and staging keyframes and looks for keyframes with the given environment value type and sets the stored value for interpolate. More...
 
void setAllMin (QString, float)
 Goes through all keyframes and staging keyframes and looks for keyframes with the given environment value type and sets the stored value for min value allowed. More...
 
void setAllMax (QString, float)
 Goes through all keyframes and staging keyframes and looks for keyframes with the given environment value type and sets the stored value for max value allowed. More...
 
void setAllMinRate (QString, float)
 Goes through all keyframes and staging keyframes and looks for keyframes with the given environment value type and sets the stored value for min rate allowed. More...
 
void setAllMaxRate (QString, float)
 Goes through all keyframes and staging keyframes and looks for keyframes with the given environment value type and sets the stored value for max rate allowed. More...
 
void setManualAdjustment (QString, float)
 Sets the manual adjustment property of the given environment value type. More...
 
float getCumulativeContribution (QString, QString)
 Retrives the cumulative contribution for a device and environment value type. More...
 
void setContribution (QString, QString, double, double, bool)
 Sets the rate, limit and if it is cumulative properties for the environment value for the specified device. More...
 
void removeCumulativeContribution (QString, QString)
 Removes the cumulative contribution for the environment value and device pair. More...
 
void setThingTransferenceMultiplier (QString, QString, float)
 Sets the thing transference multipler the environment value and device pair. More...
 
float getTotalContributions (QString)
 Retrives the total contribution for all environment entries of the given environment value type. More...
 
int getSimTimeSetting ()
 Retrives second value of the "Simulation Time Scale:". More...
 
int getRealTimeSetting ()
 Retrives first value of the "Simulation Time Scale:". More...
 
int getSimTimeCombo ()
 
int getRealTimeCombo ()
 
void setSimTimeSetting (int)
 
void setRealTimeSetting (int)
 
void setSimTimeCombo (int)
 
void setRealTimeCombo (int)
 
bool isUsingMetric ()
 Returns if the environment is using the metric system or imperial. More...
 
QString getNotes ()
 
void setNotes (QString)
 
bool isShowNotes ()
 Returns if notes are set to show in the environment advanced options window. More...
 
void setShowNotes (bool)
 Sets the environment window property for whether notes should be shown in the advanced window. More...
 
bool isEditingLocked ()
 Returns if the environment editing window has been locked by interace locking option. More...
 
void addCustomEnvironment (QString, QString, QString, QString, QString, QString, QString, QString)
 Adds a custom environment value type to the environment. More...
 
void removeCustomEnvironment (QString)
 Removes a custom environment value type from the environment. This is only for custom properties, not for included properties like "CO2". More...
 
bool isCustomEnvironment (QString)
 Returns true if the environment value is a custom environment value. More...
 
int getNextKeyTime ()
 Debugging tool for getting the next keyframe time. More...
 
int getCurrentKeyTime ()
 Debugging tool for getting the current keyframe time. More...
 
int getElapsedTime (int)
 Returns the time difference between the given time and the current environment time, in seconds. More...
 
int getKeyframeTemplateCount ()
 Returns how many default keyframe categores there are in the "Defaults:" section of the environment window when setting up advanced keyframes. More...
 
QString getKeyframeTemplateAt (int)
 Returns the default keyframe template name at the given index. More...
 
void importKeyframeTemplate (QString)
 Starts importing a default keyframe template. More...
 
Environment parentEnvironment ()
 Returns the parent environment. More...
 
void setGraphEnvironment (QString)
 
QString getGraphEnvironment ()
 
float getVolume ()
 Returns the total volume of the object that contains the environment. More...
 
QString getChangesAsJSON ()
 Returns change information as JSON data. More...
 
QString getKeyframeDataAsJSON (QString)
 Returns keyframes with the given environment value as JSON data. More...
 
bool removeEnvironmentKeyframe (QString, int)
 Removes the environment keyframe at the given time if it has the given environment variable type and it isn't the start or end keyframe. More...
 

Detailed Description

An object in the Physical Workspace.

Environment Dialog.

Member Function Documentation

◆ addCustomEnvironment()

void Environment::addCustomEnvironment ( QString  ,
QString  ,
QString  ,
QString  ,
QString  ,
QString  ,
QString  ,
QString   
)

Adds a custom environment value type to the environment.

Parameters
categoryId,categoryto add the value to, like "Radiation" or "Other".
category,categoryto add, make it the same as categoryId.
id,nameof the environment value. Like "Sweetness"
name,nameto display in the editor window for the environment value.
metricUnit,metricunit to display when display the value is in metric units.
imperialUnit,imperialunit to display when value is in imperial units.
imperialFormula,conversionformula to convert from

◆ addKeyframe()

EnvironmentKeyframe Environment::addKeyframe ( int  )

Adds a keyframe at the specified time and returns the new keyframe.

Parameters
time,thetime to add the keyframe at, in seconds. Time loops every 24 hours so the valid range is [0, 86400).
Returns
EnvironmentKeyframe, the keyframe added.

◆ addKeyframeFromStaging()

int Environment::addKeyframeFromStaging ( )

Adds a keyframe from staging.

Returns
int, value is index of the keyframe after it gets added from staging.

◆ exportToFile()

void Environment::exportToFile ( )

Starts the process for saving the environment window values to an xml file.

◆ getChangesAsJSON()

QString Environment::getChangesAsJSON ( )

Returns change information as JSON data.

Returns
QString, return is the change information as JSON data.

◆ getCumulativeContribution()

float Environment::getCumulativeContribution ( QString  ,
QString   
)

Retrives the cumulative contribution for a device and environment value type.

Parameters
env,nameof the environment to read the value for.
devName,deviceto find the environment value for.
Returns
float, value is the cumulative contribution based on the params.

◆ getCurrentKeyTime()

int Environment::getCurrentKeyTime ( )

Debugging tool for getting the current keyframe time.

Returns
int, return is the current keyframe time.

◆ getElapsedTime()

int Environment::getElapsedTime ( int  )

Returns the time difference between the given time and the current environment time, in seconds.

Parameters
lastTime,timeto subtract from the current time to find the difference.
Returns
int, return is the time difference between the current time and the given time.

◆ getEnvironment()

EnvironmentOptions Environment::getEnvironment ( QString  )

Returns the options for a specified environment value type, like "CO" for carbon monoxide.

Parameters
env,nameof the environment value to retrive, like "CO".
Returns
EnvironmentOptions, value is the options for the specificed environment value type.

◆ getEnvironmentKeys()

vector< QString > Environment::getEnvironmentKeys ( )

Returns a list of all the environment value types.

Returns
vector<QString>, value is a list of all the environment value types.

◆ getEnvironmentOptionsCount()

int Environment::getEnvironmentOptionsCount ( )

\Returns how many environment value types there are. Categories are not included in the count, just the contents of all combined.

Returns
int, value is the count of all environment values.

◆ getEnvironmentValue()

float Environment::getEnvironmentValue ( QString  )

Returns the value for the specified environment property.

Parameters
env,nameof the environment value to retrive, like "CO".
Returns
float, value is the value of the environment value. If not found it will return -1, but that can also be a valued value.

◆ getGraphEnvironment()

QString Environment::getGraphEnvironment ( )

◆ getKeyframeAt()

EnvironmentKeyframe Environment::getKeyframeAt ( int  )

How Returns a keyframe at a specified index.

Parameters
index,thekeyframe to retrive. Range of [0, getKeyframeCount()).
Returns
EnvironmentKeyframe, the keyframe at the given index.

◆ getKeyframeCount()

int Environment::getKeyframeCount ( )

How many key frames are in the environment.

Returns
int, the number of key frames in the environment.

◆ getKeyframeDataAsJSON()

QString Environment::getKeyframeDataAsJSON ( QString  )

Returns keyframes with the given environment value as JSON data.

Parameters
envID,theenvironment variable type to get the information for.
Returns
QString, return is the keyframes' information for the given environment value as JSON data.

◆ getKeyframeIndexAtTime()

int Environment::getKeyframeIndexAtTime ( int  )

Returns the index of a keyframe at the given time if one exists.

Parameters
time,timein seconds to retrive the keyframe index for. Time loops every 24 hours so the valid range is [0, 86400).
Returns
int, value is the index if a match was found, -1 if not.

◆ getKeyframeTemplateAt()

QString Environment::getKeyframeTemplateAt ( int  )

Returns the default keyframe template name at the given index.

Parameters
index,indexof the template to retrive. Range (0, getKeyFrameTemplateCount())
Returns
QString, return is the default keyframe template name at the given index if it exists, crash if it doesn't.

◆ getKeyframeTemplateCount()

int Environment::getKeyframeTemplateCount ( )

Returns how many default keyframe categores there are in the "Defaults:" section of the environment window when setting up advanced keyframes.

Returns
int, return is how many default keyframe categores there are in the "Defaults:" section of the environment window when setting up advanced keyframes.

◆ getMetricValue()

float Environment::getMetricValue ( QString  )

Returns the metric value for the given environment value.

Parameters
env,nameof the environment value to retrive, like "CO".
Returns
float, value is the metric value of the environment value.

◆ getNextKeyTime()

int Environment::getNextKeyTime ( )

Debugging tool for getting the next keyframe time.

Returns
int, return is the next keyframe time.

◆ getNotes()

QString Environment::getNotes ( )

◆ getRealTimeCombo()

int Environment::getRealTimeCombo ( )

◆ getRealTimeSetting()

int Environment::getRealTimeSetting ( )

Retrives first value of the "Simulation Time Scale:".

Returns
int, retun is the value of the first property of "Simulation Time Scale:".

◆ getSimTimeCombo()

int Environment::getSimTimeCombo ( )

◆ getSimTimeSetting()

int Environment::getSimTimeSetting ( )

Retrives second value of the "Simulation Time Scale:".

Returns
int, retun is the value of the second property of "Simulation Time Scale:".

◆ getStagingKeyframe()

EnvironmentKeyframe Environment::getStagingKeyframe ( )

Returns the staging keyframe.

Returns
EnvironmentKeyframe, value is the staging keyframe.

◆ getTimeInSeconds()

int Environment::getTimeInSeconds ( )

Returns the current environment runtime, in seconds. The value loops, so after 24 hours it resets to 0.

Returns
int, the current environment runtime, in seconds.

◆ getTimeMultiplier()

float Environment::getTimeMultiplier ( )

Multiplier used when calculating how much environment time passes each step, in seconds.

Returns
float, the current environment runtime, in seconds.

◆ getTotalContributions()

float Environment::getTotalContributions ( QString  )

Retrives the total contribution for all environment entries of the given environment value type.

Parameters
env,nameof the environment to read the value for.
Returns
float, value is the total contribution based of the given environment value type.

◆ getUnit()

QString Environment::getUnit ( QString  )

Returns the unit used for the specified environment property.

Parameters
env,nameof the environment value to retrive, like "CO".
Returns
QString, value is the unit displayed for the environment value type, like "%" for gasses. The return can be an empty string.

◆ getValueWithUnit()

QString Environment::getValueWithUnit ( QString  )

Returns a string combining the specified environment property and the display unit is uses.

Parameters
env,nameof the environment value to retrive, like "CO".
Returns
QString, value is a string combining the specified environment property and the display unit is uses.

◆ getVolume()

float Environment::getVolume ( )

Returns the total volume of the object that contains the environment.

Returns
float, return is the total volume of the object that contains the environment.

◆ hasKeyframeAtTime()

bool Environment::hasKeyframeAtTime ( int  )

Returns if there is a keyframe at the given time.

Parameters
time,timein seconds to retrive the keyframe for. Time loops every 24 hours so the valid range is [0, 86400).
Returns
bool, true if there was a keyframe, false if not.

◆ importFromFile()

void Environment::importFromFile ( )

Starts the save process for importing the environment window values from an xml file.

◆ importKeyframeTemplate()

void Environment::importKeyframeTemplate ( QString  )

Starts importing a default keyframe template.

Parameters
file,thename of the template to import. Like "Blank.xml".
Returns
QString, return is the default keyframe template name at the given index if it exists, crash if it doesn't.

◆ isCustomEnvironment()

bool Environment::isCustomEnvironment ( QString  )

Returns true if the environment value is a custom environment value.

Returns
bool, return is true if the environment exists and is a custom property or doesn't exist, false if it is not custom.

◆ isEditingLocked()

bool Environment::isEditingLocked ( )

Returns if the environment editing window has been locked by interace locking option.

Returns
bool, retun is true if the environment window is locked, false if not.

◆ isEditMode()

bool Environment::isEditMode ( )

Returns true if the environment editor window is in Edit mode.

Returns
bool, value is true if the enviroment window is in Edit mode, false if it is in View mode.

◆ isShowNotes()

bool Environment::isShowNotes ( )

Returns if notes are set to show in the environment advanced options window.

Returns
bool, retun is true if notes are set to show, false if set to hidden.

◆ isTimeRunning()

bool Environment::isTimeRunning ( )

Returns true if the environment time is running, false if paused.

Returns
bool, true if the environment time is running, false if paused.

◆ isUsingMetric()

bool Environment::isUsingMetric ( )

Returns if the environment is using the metric system or imperial.

Returns
bool, retun is true if the environment it set to use the metric system, false for imperial.

◆ parentEnvironment()

Environment Environment::parentEnvironment ( )

Returns the parent environment.

Returns
Environment, return is the parent environment if it exists, null if not.

◆ pauseTime()

void Environment::pauseTime ( )

Pauses the environment time.

◆ removeCumulativeContribution()

void Environment::removeCumulativeContribution ( QString  ,
QString   
)

Removes the cumulative contribution for the environment value and device pair.

Parameters
env,nameof the environment value to remove for.
devName,deviceto remove for.

◆ removeCustomEnvironment()

void Environment::removeCustomEnvironment ( QString  )

Removes a custom environment value type from the environment. This is only for custom properties, not for included properties like "CO2".

Parameters
env,nameof the environment value. Like "Sweetness"

◆ removeEnvironmentKeyframe()

bool Environment::removeEnvironmentKeyframe ( QString  ,
int   
)

Removes the environment keyframe at the given time if it has the given environment variable type and it isn't the start or end keyframe.

Parameters
envID,theenvironment variable type that must be in the specified keyframe time for it to be removed.
time,theenvironment time of the keyframe to remove.
Returns
bool, return is true a keyframe was removed, false if not.

◆ removeKeyframe()

void Environment::removeKeyframe ( int  )

Removes the keyframe at the given index if the keyframe exists and isn't the start or end.

Parameters
index,indexof the keyframe to remove. Range of (1, getKeyframeCount()-1).

◆ resumeTime()

void Environment::resumeTime ( )

Resumes the environment time.

◆ setAllActive()

void Environment::setAllActive ( QString  ,
bool   
)

Goes through all keyframes and staging keyframes and looks for keyframes with the given environment value type and sets them active/inactive.

Parameters
envId,nameof the environment to check keyframes for.
bOn,trueif keyframes containing the value should be activated, false if deactivated.

◆ setAllInterpolate()

void Environment::setAllInterpolate ( QString  ,
bool   
)

Goes through all keyframes and staging keyframes and looks for keyframes with the given environment value type and sets the stored value for interpolate.

Parameters
envId,nameof the environment to check keyframes for.
bOn,trueto use interpolation, false to not.

◆ setAllMax()

void Environment::setAllMax ( QString  ,
float   
)

Goes through all keyframes and staging keyframes and looks for keyframes with the given environment value type and sets the stored value for max value allowed.

Parameters
envId,nameof the environment to check keyframes for.
value,maxvalue allowed by the environment value.

◆ setAllMaxRate()

void Environment::setAllMaxRate ( QString  ,
float   
)

Goes through all keyframes and staging keyframes and looks for keyframes with the given environment value type and sets the stored value for max rate allowed.

Parameters
envId,nameof the environment to check keyframes for.
value,maxrate value used by the environment value.

◆ setAllMin()

void Environment::setAllMin ( QString  ,
float   
)

Goes through all keyframes and staging keyframes and looks for keyframes with the given environment value type and sets the stored value for min value allowed.

Parameters
envId,nameof the environment to check keyframes for.
value,minvalue allowed by the environment value.

◆ setAllMinRate()

void Environment::setAllMinRate ( QString  ,
float   
)

Goes through all keyframes and staging keyframes and looks for keyframes with the given environment value type and sets the stored value for min rate allowed.

Parameters
envId,nameof the environment to check keyframes for.
value,minrate value used by the environment value.

◆ setAllShow()

void Environment::setAllShow ( QString  ,
bool   
)

Goes through all keyframes and staging keyframes and looks for keyframes with the given environment value type and sets the stored value for show.

Parameters
envId,nameof the environment to check keyframes for.
bOn,trueif keyframes containing the value and the value should be shown, false if not shown.

◆ setAllTransference()

void Environment::setAllTransference ( QString  ,
float   
)

Goes through all keyframes and staging keyframes and looks for keyframes with the given environment value type and sets the stored value for transference.

Parameters
envId,nameof the environment to check keyframes for.
value,transferenceto use.

◆ setContribution()

void Environment::setContribution ( QString  ,
QString  ,
double  ,
double  ,
bool   
)

Sets the rate, limit and if it is cumulative properties for the environment value for the specified device.

Parameters
env,nameof the environment value to set the values for.
devName,deviceto set for.
rate,rateto use. If 0 it wipes out all the values and doesn't set any of the values passed.
limit,limitto use.
bCumulative,trueif it should be set to cumulative, false if not.

◆ setCurrentKeyTime()

void Environment::setCurrentKeyTime ( int  )

◆ setEditMode()

void Environment::setEditMode ( bool  )

◆ setGraphEnvironment()

void Environment::setGraphEnvironment ( QString  )

◆ setKeyframeActive()

void Environment::setKeyframeActive ( int  ,
QString  ,
bool   
)

Sets the specified keyframe to active and the environment value in it to be active.

Parameters
currentKeyframeIndex,indexof the keyframe to set.
envId,nameof the environment to set for in the keyframe.
bOn,trueif keyframes containing the value should be activated, false if deactivated.

◆ setManualAdjustment()

void Environment::setManualAdjustment ( QString  ,
float   
)

Sets the manual adjustment property of the given environment value type.

Parameters
env,thename of the environment value type to set the property for. Like "CO2".
value,valueto set the env property value with.

◆ setNextKeyTime()

void Environment::setNextKeyTime ( int  )

◆ setNotes()

void Environment::setNotes ( QString  )

◆ setRealTimeCombo()

void Environment::setRealTimeCombo ( int  )

◆ setRealTimeSetting()

void Environment::setRealTimeSetting ( int  )

◆ setShowNotes()

void Environment::setShowNotes ( bool  )

Sets the environment window property for whether notes should be shown in the advanced window.

Parameters
b,trueto set notes to show when advanced options are viewied, false if they should be hidden.

◆ setSimTimeCombo()

void Environment::setSimTimeCombo ( int  )

◆ setSimTimeSetting()

void Environment::setSimTimeSetting ( int  )

◆ setThingTransferenceMultiplier()

void Environment::setThingTransferenceMultiplier ( QString  ,
QString  ,
float   
)

Sets the thing transference multipler the environment value and device pair.

Parameters
env,nameof the environment value to remove for.
devName,deviceto remove for.
multiplier,multiplierto store.

◆ setTimeInSeconds()

void Environment::setTimeInSeconds ( int  )

Sets the current environment time to the given time, in seconds. Time loops every 24 hours.

Parameters
seconds,thenumber of seconds to set the current environment time to. Time loops every 24 hours so the valid range is [0, 86400).

◆ setTimeMultiplier()

void Environment::setTimeMultiplier ( float  )

Sets the multiplier used when calculating how much environment time passes each step, in seconds.

Parameters
x,thenumber of seconds to set the step multipler as.

The documentation for this class was generated from the following file: