Cisco Packet Tracer Extensions API 8.1.0
API for communication between Cisco Packet Tracer application and its extension applications and modules.
|
Device is the base class for all device objects. More...
Public Member Functions | |
void | setName (QString) |
Sets the display name of this device. More... | |
QString | getName () |
Returns the display name of this device. More... | |
void | nameChanged (QString, QString) |
IPC event. More... | |
void | setPower (bool) |
Sets the power on or off. More... | |
void | addSound (QString, QString) |
Adds sound to the device. More... | |
void | playSound (QString, int) |
Play sound to the device. More... | |
void | stopSound (QString) |
Stop playing sound on the device. More... | |
void | stopSounds () |
Stops playing all sounds on the device. More... | |
void | destroySounds () |
Destroy all of the sounds on the device. More... | |
bool | getPower () |
Returns the current power state of this device. More... | |
double | getXCoordinate () |
Returns the current x-coordinate position in the Logical workspace for this device. More... | |
double | getYCoordinate () |
Returns the current y-coordinate position in the Logical workspace for this device. More... | |
double | getCenterXCoordinate () |
Returns the current x-coordinate position in the Logical workspace for this device. More... | |
double | getCenterYCoordinate () |
Returns the current y-coordinate position in the Logical workspace for this device. More... | |
double | getAreaTopY () |
Returns the current topmost y-coordinate position in the for this device. More... | |
double | getAreaLeftX () |
Returns the current leftmost x-coordinate position in the for this device. More... | |
bool | moveToLocationCentered (int, int) |
Moves this device to the specified location for its center in Logical workspace. More... | |
bool | moveToLocation (int, int) |
Moves this device to the specified location in Logical workspace. More... | |
int | getXPhysicalWS () |
Returns the current x-coordinate position in the Physical workspace for this device. More... | |
int | getYPhysicalWS () |
Returns the current y-coordinate position in the Physical workspace for this device. More... | |
double | getGlobalXPhysicalWS () |
Returns the current global x-coordinate position in the Physical workspace for this device. More... | |
double | getGlobalYPhysicalWS () |
Returns the current global y-coordinate position in the Physical workspace for this device. More... | |
bool | moveToLocInPhysicalWS (int, int) |
Moves this device to the specified location in Physical workspace. More... | |
bool | moveByInPhysicalWS (int, int) |
Moves this device by the specified amount in Physical workspace. More... | |
void | powerChanged (bool) |
IPC event. More... | |
void | poweringOff () |
IPC event. More... | |
DeviceType | getType () |
Returns the type of this device. More... | |
string | getModel () |
Returns the model of this device. More... | |
DeviceDescriptor | getDescriptor () |
Returns the device descriptor that user can get information on the device like type, model, module supported.. More... | |
string | getSerialNumber () |
Returns the device serial number. More... | |
Port | getPort (string) |
Returns the Port object with the specified port name. More... | |
int | getPortCount () |
Returns the number of ports in this device. More... | |
Port | getPortAt (int) |
Returns the Port object at the specified index. More... | |
Process | getProcess (string) |
Returns the Process object associated the process name. More... | |
int | getUsbPortCount () |
Return the number of usb port. More... | |
UsbPort | getUsbPortAt (int) |
Returns the usb port at a specified index. More... | |
Module | getRootModule () |
Returns the root module of the device. More... | |
bool | addModule (string, ModuleType, string) |
Adds a specific module to a particular slot. More... | |
bool | removeModule (string) |
Removes the module from the slot. More... | |
void | moduleAdded (ModuleType, string, string) |
This event is emitted when a module is added. More... | |
void | moduleRemoved (ModuleType, string, string) |
This event is emitted when a module is removed. More... | |
void | portAdded (string) |
This event is emitted when a port is added. More... | |
void | portRemoved (string) |
This event is emitted when a port is removed. More... | |
void | portRemoving (string) |
This event is emitted when a port is being removed but before it is actually removed. This is useful for script modules to clean up things before the port is removed. More... | |
TerminalLine | getCommandLine () |
Returns the command line TerminalLine object. More... | |
void | addCustomVar (QString, QString) |
Adds a custom variable. More... | |
bool | removeCustomVar (QString) |
Removes a custom variable. More... | |
bool | hasCustomVar (QString) |
Returns true if this device has a custom variable with the specified name. More... | |
QString | getCustomVarStr (QString) |
Returns the value of the variable with the specified name. More... | |
int | getCustomVarsCount () |
Returns the number of custom variables this device has. More... | |
QString | getCustomVarNameAt (int) |
Returns the name of the custom variable at the specified index. More... | |
QString | getCustomVarValueStrAt (int) |
Returns the value of the custom variable at the specified index. More... | |
void | setCustomInterface (QString) |
Set custom interface to the device. More... | |
QString | getCustomInterface () |
Get custom interface name on the device. More... | |
QString | serializeToXml () |
Returns the serialization string of this device. More... | |
QString | activityTreeToXml () |
Returns the serialization string of this device's activity tree. More... | |
PhysicalObject | getPhysicalObject () |
Get custom interface name on the device. More... | |
QString | getCustomLogicalImage () |
Get custom logical image path. More... | |
void | setCustomLogicalImage (QString) |
Set custom logical image path. More... | |
QString | getCustomPhysicalImage () |
Get custom physical image path. More... | |
void | setCustomPhysicalImage (QString) |
Set custom physical image path. More... | |
vector< string > | getSupportedModule () |
Get a vector of supported modules. More... | |
void | setTime (int, int, int, int, int, int) |
Set time to the device. More... | |
long | getUpTime () |
Set time to the device. More... | |
vector< string > | getPorts () |
Set time to the device. More... | |
double | getDeviceExternalAttributeValue (string) |
Get device external attribute value. More... | |
void | setDeviceExternalAttributes (QString) |
Set device external attribute value. More... | |
void | addDeviceExternalAttributes (QString) |
Add device external attribute value. More... | |
void | subtractDeviceExternalAttributes (QString) |
Remove some of the device external attribute value pairs from the current list. More... | |
QString | getDeviceExternalAttributes () |
Returns the list of external attributes and associated values. More... | |
void | clearDeviceExternalAttributes () |
bool | isOutdated () |
bool | restoreToDefault (bool, bool) |
void | updateTemplateCreationTime () |
bool | runProject (string, string) |
Runs a programming project in the mcu. More... | |
bool | stopProject (string) |
Stops a programming project in the mcu. More... | |
bool | isProjectRunning (string) |
Checks if a programming project with the given name is running. More... | |
bool | runCodeInProject (string, string) |
Runs additional code in the given project. More... | |
void | addProgrammingSerialOutputs (string) |
Writes to the programming output. Text appears in the programming output dialog. More... | |
string | getProgrammingSerialOutputs () |
Gets the programming output. It is the text that appears in the programming output dialog. More... | |
void | clearProgrammingSerialOutputs () |
Clears the programming output dialog. More... | |
UserDesktopAppConfig | addUserDesktopApp (string) |
UserDesktopAppConfig | addUserDesktopAppFrom (UserDesktopAppConfig) |
UserDesktopAppConfig | addUserDesktopAppFromGlobal (string) |
int | getUserDesktopAppCount () |
UserDesktopAppConfig | getUserDesktopAppAt (int) |
UserDesktopAppConfig | getUserDesktopAppByDir (string) |
UserDesktopAppConfig | getUserDesktopAppById (string) |
void | removeUserDesktopApp (string) |
void | relinkUserDesktopApp (string, string) |
bool | isDesktopAvailable () |
Device is the base class for all device objects.
QString Device::activityTreeToXml | ( | ) |
Returns the serialization string of this device's activity tree.
QString,the | serialization string of this device activity tree. |
void Device::addCustomVar | ( | QString | , |
QString | |||
) |
Adds a custom variable.
name,the | name of the variable. |
var,the | value of the variable. |
void Device::addDeviceExternalAttributes | ( | QString | ) |
Add device external attribute value.
attributeValues,QString | attribute value pair in json format |
bool Device::addModule | ( | string | , |
ModuleType | , | ||
string | |||
) |
Adds a specific module to a particular slot.
slot,the | slot to add the module to. |
type,the | type of the module. Module types: eLineCard = 0, eNetworkModule = 1, eInterfaceCard = 2, ePtRouterModule = 3, ePtSwitchModule = 4, ePtCloudModule = 5, ePtRepeaterModule = 6, ePtHostModule = 7, ePtModemModule = 8, ePtLaptopModule = 9, ePtTVModule = 10, eIpPhonePowerAdapter = 11, ePtTabletPCModule = 12, ePtPdaModule = 13, ePtWirelessEndDeviceModule = 14, ePtWiredEndDeviceModule = 15, eTrs35 = 16, eUsb = 17, eNonRemovableModule = 18, eASAPowerAdapter = 19 |
model,the | model name of the module. |
void Device::addProgrammingSerialOutputs | ( | string | ) |
Writes to the programming output. Text appears in the programming output dialog.
output,text | to write. |
void Device::addSound | ( | QString | , |
QString | |||
) |
Adds sound to the device.
soundPath,the | path to the sound file |
soundId,the | id to identify the sound from other sounds |
UserDesktopAppConfig Device::addUserDesktopApp | ( | string | ) |
UserDesktopAppConfig Device::addUserDesktopAppFrom | ( | UserDesktopAppConfig | ) |
UserDesktopAppConfig Device::addUserDesktopAppFromGlobal | ( | string | ) |
void Device::clearDeviceExternalAttributes | ( | ) |
void Device::clearProgrammingSerialOutputs | ( | ) |
Clears the programming output dialog.
void Device::destroySounds | ( | ) |
Destroy all of the sounds on the device.
double Device::getAreaLeftX | ( | ) |
Returns the current leftmost x-coordinate position in the for this device.
double Device::getAreaTopY | ( | ) |
Returns the current topmost y-coordinate position in the for this device.
double Device::getCenterXCoordinate | ( | ) |
Returns the current x-coordinate position in the Logical workspace for this device.
double Device::getCenterYCoordinate | ( | ) |
Returns the current y-coordinate position in the Logical workspace for this device.
TerminalLine Device::getCommandLine | ( | ) |
Returns the command line TerminalLine object.
QString Device::getCustomInterface | ( | ) |
Get custom interface name on the device.
QString Device::getCustomLogicalImage | ( | ) |
Get custom logical image path.
QString Device::getCustomPhysicalImage | ( | ) |
Get custom physical image path.
QString Device::getCustomVarNameAt | ( | int | ) |
Returns the name of the custom variable at the specified index.
index,the | index of the variable of interest. |
QString,the | name of the custom variable at the specified index. |
int Device::getCustomVarsCount | ( | ) |
Returns the number of custom variables this device has.
QString,the | number of custom variables this device has. |
QString Device::getCustomVarStr | ( | QString | ) |
Returns the value of the variable with the specified name.
name,the | name of the variable of interest. |
QString,the | value of the custom variable. |
QString Device::getCustomVarValueStrAt | ( | int | ) |
Returns the value of the custom variable at the specified index.
index,the | index of the variable of interest. |
QString,the | value of the custom variable at the specified index. |
DeviceDescriptor Device::getDescriptor | ( | ) |
Returns the device descriptor that user can get information on the device like type, model, module supported..
QString Device::getDeviceExternalAttributes | ( | ) |
Returns the list of external attributes and associated values.
QString,attribute | value pair in json format |
double Device::getDeviceExternalAttributeValue | ( | string | ) |
Get device external attribute value.
double Device::getGlobalXPhysicalWS | ( | ) |
Returns the current global x-coordinate position in the Physical workspace for this device.
double Device::getGlobalYPhysicalWS | ( | ) |
Returns the current global y-coordinate position in the Physical workspace for this device.
string Device::getModel | ( | ) |
Returns the model of this device.
QString Device::getName | ( | ) |
Returns the display name of this device.
PhysicalObject Device::getPhysicalObject | ( | ) |
Get custom interface name on the device.
Port Device::getPort | ( | string | ) |
Port Device::getPortAt | ( | int | ) |
int Device::getPortCount | ( | ) |
Returns the number of ports in this device.
vector< string > Device::getPorts | ( | ) |
Set time to the device.
bool Device::getPower | ( | ) |
Returns the current power state of this device.
Process Device::getProcess | ( | string | ) |
Returns the Process object associated the process name.
process,the | name of the process. Valid process names. Not all names have an interface to interact with. Only get names for which there are interfaces. The word "Process" is optional and may be appended to the end or ommitted.: Aaa, AcsServer, RadiusClient, RadiusServer, TacacsClient, TacacsServer, Acl, Aclv6, PingTcp, Settings, AnalogPhoneHandler, AnalogPhone, ArpLookUp, Arp, AsaAcl, AsaAclv6, Firewall, Firewallv6, AsaNat, AsaNatv6, Bgp, BluetoothManager, CustomBluetooth, Bridge, BVIManager, CapwapAC, Capwap, Cbac, Cbacv6, Cdp, CellularClientManager, CellularClient, Cellular, COPapChapAuthenticator, ParserViewManager, PrivilegeManager, PortMapped, DhcpClient, DhcpRelayAgent, DhcpServerMain, DhcpServer, DhcpSnoopingBindingDBAgent, DhcpSnooping, Dhcpv6Client, Dhcpv6Main, Dhcpv6ServerMain, Dhcpv6Server, DnsClient, DnsResolver, DnsServer, Dtp, EigrpMain, Eigrp, Eigrpv6Main, Eigrpv6, EtherChannel, EtherChannelDispatcher, EtherChannelManager, Lacp, Pagp, CsmaCd, Dot1QEncap, Dot1QSubIntDispatcher, EthernetEncap, FileManager, DlciLookUp, FrameRelayMain, FrameRelay, FRSubIntDispatcher, InvArp, LmiSignaling, FtpClient, FtpServer, Gre, TunnelInterface, Hdlc, Hsrp, Hsrpv6, HttpBackgroundClient, HttpBackgroundClientManager, HttpClient, HttpProxy, HttpServer, HttpsServer, IoxServer, WebSocketClient, Wlc2504HttpsServer, Wlc2504Server, Icmp, Ping, TraceRoute, Icmpv6, CustomIO, IoeClient, IoEComponent, Ioe, IoeServer, IoeUserManager, IoxGuestOs, UserApp, UserJsApp, UserPyApp, HostIp, IpFragmentation, Ips, HostIpv6, Ipv6Fragmentation, PMTUDiscovery, Ipv6Ip, IsatapClient, L2Nat, LinksysRouterEventHandler, Lldp, Loopback, LoopbackManager, EmailClient, EmailServer, Nat, NatV6, Nd, NeighborLookUp, Netflow, Netflowv6, NFCollector, NFExporter, NtpClient, NtpServer, OspfMain, Ospf, Ospfv3Main, Ospfv3, Pop3Client, Pop3Server, InterfaceStatus, PortKeepAlive, Chap, PAP, PhoneSignaling, PppMain, Ppp, DialerInterface, DialerInterfaceManager, PppoeClient, PppoeClientManager, Pppoe, PppoeServer, VirtualAccessInterface, VirtualTemplateInterface, VirtualTemplateManager, PTP, Rep, CableSignaling, CloudSwitcher, DslSignaling, Forwarding, LoopBreaker, PatchWire, Repeater, Rip, Ripv6Main, Ripv6, IpUnnumberDispatcher, PortDispatcher, Routing, RoutingProtocol, RoutingProcessv6, Security, SmtpClient, SmtpServer, SnmpAgent, SnmpManager, SshClient, SshServer, StpMain, Stp, MacSwitcher, PortSecurity, SdmManager, Span, SpanDest, SpanDestLocalPort, SpanSource, SpanSourceLocalPort, SpanSourceLocalPortChannel, SpanSourceLocalVlan, VlanManager, WLCMacSwitcher, SyslogClient, SyslogServer, CustomTcp, Tcp, TcpUserTraffic, ReverseTelnet, TelnetClient, TelnetServer, TftpClient, TftpServer, TftpSession, TftpSessionManager, Tv, CustomUdp, Udp, UdpTraceRoute, UsbController, CME, H323Client, H323, H323Server, PhoneMedia, Rtp, SccpClient, SccpServer, VoiceSwitcher, Ah, EasyVpnClient, EasyVpnServer, Esp, Ike, Ipsec, Vtp, AccessPointSwitcher, CsmaCa, LWAccessPointSwitcher, LWWirelessServer, WEP, WirelessClient, WirelessCommon, WirelessEncap, WirelessServerManager, WirelessServer, WLCServer, WPA, Zfw, Zfwv6 |
string Device::getProgrammingSerialOutputs | ( | ) |
Gets the programming output. It is the text that appears in the programming output dialog.
Module Device::getRootModule | ( | ) |
Returns the root module of the device.
string Device::getSerialNumber | ( | ) |
Returns the device serial number.
vector< string > Device::getSupportedModule | ( | ) |
Get a vector of supported modules.
DeviceType Device::getType | ( | ) |
Returns the type of this device.
long Device::getUpTime | ( | ) |
Set time to the device.
UsbPort Device::getUsbPortAt | ( | int | ) |
Returns the usb port at a specified index.
int Device::getUsbPortCount | ( | ) |
Return the number of usb port.
UserDesktopAppConfig Device::getUserDesktopAppAt | ( | int | ) |
UserDesktopAppConfig Device::getUserDesktopAppByDir | ( | string | ) |
UserDesktopAppConfig Device::getUserDesktopAppById | ( | string | ) |
int Device::getUserDesktopAppCount | ( | ) |
double Device::getXCoordinate | ( | ) |
Returns the current x-coordinate position in the Logical workspace for this device.
int Device::getXPhysicalWS | ( | ) |
Returns the current x-coordinate position in the Physical workspace for this device.
double Device::getYCoordinate | ( | ) |
Returns the current y-coordinate position in the Logical workspace for this device.
int Device::getYPhysicalWS | ( | ) |
Returns the current y-coordinate position in the Physical workspace for this device.
bool Device::hasCustomVar | ( | QString | ) |
Returns true if this device has a custom variable with the specified name.
name,the | name of the variable of interest. |
var,true | if this device has a custom variable with the specified name. |
bool Device::isDesktopAvailable | ( | ) |
bool Device::isOutdated | ( | ) |
bool Device::isProjectRunning | ( | string | ) |
Checks if a programming project with the given name is running.
projectName,The | name of the project to check is running. Something like "Blink (JavaScript)" |
void Device::moduleAdded | ( | ModuleType | , |
string | , | ||
string | |||
) |
This event is emitted when a module is added.
IPC event.
void Device::moduleRemoved | ( | ModuleType | , |
string | , | ||
string | |||
) |
This event is emitted when a module is removed.
IPC event.
bool Device::moveByInPhysicalWS | ( | int | , |
int | |||
) |
Moves this device by the specified amount in Physical workspace.
x,the | x-amount to move by. |
y,the | y-amount to move by. |
bool Device::moveToLocation | ( | int | , |
int | |||
) |
Moves this device to the specified location in Logical workspace.
x,the | new x-coordinate position. |
y,the | new y-coordinate position. |
bool Device::moveToLocationCentered | ( | int | , |
int | |||
) |
Moves this device to the specified location for its center in Logical workspace.
x,the | new x-coordinate position. |
y,the | new y-coordinate position. |
bool Device::moveToLocInPhysicalWS | ( | int | , |
int | |||
) |
Moves this device to the specified location in Physical workspace.
x,the | new x-coordinate position. |
y,the | new y-coordinate position. |
void Device::nameChanged | ( | QString | , |
QString | |||
) |
IPC event.
This event is emitted when the display name is changed.
void Device::playSound | ( | QString | , |
int | |||
) |
Play sound to the device.
soundID,the | id of the sounpath to the sound file |
numLoop,the | number of times to play the sound |
void Device::portAdded | ( | string | ) |
This event is emitted when a port is added.
portName,the | name of the port that was added. |
IPC event.
void Device::portRemoved | ( | string | ) |
This event is emitted when a port is removed.
portName,the | name of the port that was removed. |
IPC event.
void Device::portRemoving | ( | string | ) |
This event is emitted when a port is being removed but before it is actually removed. This is useful for script modules to clean up things before the port is removed.
portName,the | name of the port that is being removed. |
IPC event.
void Device::powerChanged | ( | bool | ) |
void Device::poweringOff | ( | ) |
IPC event.
This event is emitted when the power is turning off but before all processes are cleared. It is useful for script modules to clean up before everything else.
void Device::relinkUserDesktopApp | ( | string | , |
string | |||
) |
bool Device::removeCustomVar | ( | QString | ) |
Removes a custom variable.
name,the | name of the variable. |
bool Device::removeModule | ( | string | ) |
Removes the module from the slot.
slot,the | slot to remove the module from. |
void Device::removeUserDesktopApp | ( | string | ) |
bool Device::restoreToDefault | ( | bool | , |
bool | |||
) |
bool Device::runCodeInProject | ( | string | , |
string | |||
) |
Runs additional code in the given project.
projectName,The | name of the project to run additional code in. Something like "Blink (JavaScript)" |
code,the | code to run. If you were writing javascript you could output text like this. "Serial.println('testing output')" |
bool Device::runProject | ( | string | , |
string | |||
) |
Runs a programming project in the mcu.
projectName,The | name of the project to run. Something like "Blink (JavaScript)" |
extraCode,does | nothing. |
QString Device::serializeToXml | ( | ) |
Returns the serialization string of this device.
QString,the | serialization string of this device. |
void Device::setCustomInterface | ( | QString | ) |
Set custom interface to the device.
QString,the | custom interface name |
void Device::setCustomLogicalImage | ( | QString | ) |
Set custom logical image path.
strPath,the | path to the custom logical image |
void Device::setCustomPhysicalImage | ( | QString | ) |
Set custom physical image path.
strPath,custom | physical image name in string |
void Device::setDeviceExternalAttributes | ( | QString | ) |
Set device external attribute value.
attributeValues,QString | attribute value pair in json format |
void Device::setName | ( | QString | ) |
Sets the display name of this device.
name,the | display name string. |
void Device::setPower | ( | bool | ) |
Sets the power on or off.
bOn,true | to set the power on, false to set the power off. |
void Device::setTime | ( | int | , |
int | , | ||
int | , | ||
int | , | ||
int | , | ||
int | |||
) |
Set time to the device.
iuHour,hour | in integer |
uiMin,minute | in integer |
uiSec,second | in integer |
uiDay,day | in integer |
uiMonth,month | in integer |
uiYear,year | in integer |
bool Device::stopProject | ( | string | ) |
Stops a programming project in the mcu.
projectName,The | name of the project to stop. Something like "Blink (JavaScript)" |
void Device::stopSound | ( | QString | ) |
Stop playing sound on the device.
soundID,the | id of the sounpath to the sound file |
void Device::stopSounds | ( | ) |
Stops playing all sounds on the device.
void Device::subtractDeviceExternalAttributes | ( | QString | ) |
Remove some of the device external attribute value pairs from the current list.
attributeValues,QString | attribute value pair in json format |
void Device::updateTemplateCreationTime | ( | ) |