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
Device Class Reference

Device is the base class for all device objects. More...

Inheritance diagram for Device:
CiscoDevice Cloud Ioe MCU Pc RemoteNetwork ASA Router MCUComponent SBC Server WirelessRouter CThing

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 ()
 

Detailed Description

Device is the base class for all device objects.

Member Function Documentation

◆ activityTreeToXml()

QString Device::activityTreeToXml ( )

Returns the serialization string of this device's activity tree.

Parameters
QString,theserialization string of this device activity tree.

◆ addCustomVar()

void Device::addCustomVar ( QString  ,
QString   
)

Adds a custom variable.

Parameters
name,thename of the variable.
var,thevalue of the variable.

◆ addDeviceExternalAttributes()

void Device::addDeviceExternalAttributes ( QString  )

Add device external attribute value.

Parameters
attributeValues,QStringattribute value pair in json format

◆ addModule()

bool Device::addModule ( string  ,
ModuleType  ,
string   
)

Adds a specific module to a particular slot.

Parameters
slot,theslot to add the module to.
type,thetype 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,themodel name of the module.
Returns
bool, true if successful, otherwise false.

◆ addProgrammingSerialOutputs()

void Device::addProgrammingSerialOutputs ( string  )

Writes to the programming output. Text appears in the programming output dialog.

Parameters
output,textto write.

◆ addSound()

void Device::addSound ( QString  ,
QString   
)

Adds sound to the device.

Parameters
soundPath,thepath to the sound file
soundId,theid to identify the sound from other sounds

◆ addUserDesktopApp()

UserDesktopAppConfig Device::addUserDesktopApp ( string  )

◆ addUserDesktopAppFrom()

UserDesktopAppConfig Device::addUserDesktopAppFrom ( UserDesktopAppConfig  )

◆ addUserDesktopAppFromGlobal()

UserDesktopAppConfig Device::addUserDesktopAppFromGlobal ( string  )

◆ clearDeviceExternalAttributes()

void Device::clearDeviceExternalAttributes ( )

◆ clearProgrammingSerialOutputs()

void Device::clearProgrammingSerialOutputs ( )

Clears the programming output dialog.

◆ destroySounds()

void Device::destroySounds ( )

Destroy all of the sounds on the device.

◆ getAreaLeftX()

double Device::getAreaLeftX ( )

Returns the current leftmost x-coordinate position in the for this device.

Returns
double, the current x-coordinate.

◆ getAreaTopY()

double Device::getAreaTopY ( )

Returns the current topmost y-coordinate position in the for this device.

Returns
double, the current y-coordinate.

◆ getCenterXCoordinate()

double Device::getCenterXCoordinate ( )

Returns the current x-coordinate position in the Logical workspace for this device.

Returns
double, the current x-coordinate.

◆ getCenterYCoordinate()

double Device::getCenterYCoordinate ( )

Returns the current y-coordinate position in the Logical workspace for this device.

Returns
double, the current y-coordinate.

◆ getCommandLine()

TerminalLine Device::getCommandLine ( )

Returns the command line TerminalLine object.

Returns
TerminalLine, the TerminalLine object.

◆ getCustomInterface()

QString Device::getCustomInterface ( )

Get custom interface name on the device.

Returns
QString, the custom interface name

◆ getCustomLogicalImage()

QString Device::getCustomLogicalImage ( )

Get custom logical image path.

Returns
QString, the custom logical image name

◆ getCustomPhysicalImage()

QString Device::getCustomPhysicalImage ( )

Get custom physical image path.

Returns
QString, custom physical image name in string

◆ getCustomVarNameAt()

QString Device::getCustomVarNameAt ( int  )

Returns the name of the custom variable at the specified index.

Parameters
index,theindex of the variable of interest.
QString,thename of the custom variable at the specified index.

◆ getCustomVarsCount()

int Device::getCustomVarsCount ( )

Returns the number of custom variables this device has.

Parameters
QString,thenumber of custom variables this device has.

◆ getCustomVarStr()

QString Device::getCustomVarStr ( QString  )

Returns the value of the variable with the specified name.

Parameters
name,thename of the variable of interest.
QString,thevalue of the custom variable.

◆ getCustomVarValueStrAt()

QString Device::getCustomVarValueStrAt ( int  )

Returns the value of the custom variable at the specified index.

Parameters
index,theindex of the variable of interest.
QString,thevalue of the custom variable at the specified index.

◆ getDescriptor()

DeviceDescriptor Device::getDescriptor ( )

Returns the device descriptor that user can get information on the device like type, model, module supported..

Returns
DeviceDescriptor, DeviceDescriptor object

◆ getDeviceExternalAttributes()

QString Device::getDeviceExternalAttributes ( )

Returns the list of external attributes and associated values.

Parameters
QString,attributevalue pair in json format

◆ getDeviceExternalAttributeValue()

double Device::getDeviceExternalAttributeValue ( string  )

Get device external attribute value.

Returns
double, attribute value

◆ getGlobalXPhysicalWS()

double Device::getGlobalXPhysicalWS ( )

Returns the current global x-coordinate position in the Physical workspace for this device.

Returns
double, the current global x-cordinate.

◆ getGlobalYPhysicalWS()

double Device::getGlobalYPhysicalWS ( )

Returns the current global y-coordinate position in the Physical workspace for this device.

Returns
double, the current global y-coordinate.

◆ getModel()

string Device::getModel ( )

Returns the model of this device.

Returns
string, the model of this device.

◆ getName()

QString Device::getName ( )

Returns the display name of this device.

Returns
QString, the display name of this device.

◆ getPhysicalObject()

PhysicalObject Device::getPhysicalObject ( )

Get custom interface name on the device.

Returns
QString, the custom interface name

◆ getPort()

Port Device::getPort ( string  )

Returns the Port object with the specified port name.

Parameters
portName,portNamecan be one of the following plus a port number where appropriate: Console, Aux, Ethernet, FastEthernet, GigabitEthernet, Serial, Wireless, Loopback, Vlan, Modem, Coaxial, Rs232, Async. Example: FastEthernet0/0
Returns
Port, the Port object associated with the port name.

◆ getPortAt()

Port Device::getPortAt ( int  )

Returns the Port object at the specified index.

Parameters
intindex, the index of the port of interest.
Returns
Port, the Port object at the specified index.

◆ getPortCount()

int Device::getPortCount ( )

Returns the number of ports in this device.

Returns
int, the number of ports in this device.

◆ getPorts()

vector< string > Device::getPorts ( )

Set time to the device.

Returns
vector<string>, vector of port names in string format

◆ getPower()

bool Device::getPower ( )

Returns the current power state of this device.

Returns
bool, true if the power is on, otherwise false.

◆ getProcess()

Process Device::getProcess ( string  )

Returns the Process object associated the process name.

Parameters
process,thename 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
Returns
Process, the Process object associated with the process name.

◆ getProgrammingSerialOutputs()

string Device::getProgrammingSerialOutputs ( )

Gets the programming output. It is the text that appears in the programming output dialog.

Returns
string, value is the text that appears in the programming output dialog.

◆ getRootModule()

Module Device::getRootModule ( )

Returns the root module of the device.

Returns
Module, The root module object.

◆ getSerialNumber()

string Device::getSerialNumber ( )

Returns the device serial number.

Returns
string, device serial number in string format

◆ getSupportedModule()

vector< string > Device::getSupportedModule ( )

Get a vector of supported modules.

Returns
vector<string>, a vector of supported module info with id and image path name in string format

◆ getType()

DeviceType Device::getType ( )

Returns the type of this device.

Returns
enum<DeviceType>, the type of this device. Device types: eRouter = 0, eSwitch = 1, eCloud = 2, eBridge = 3, eHub = 4, eRepeater = 5, eCoAxialSplitter = 6, eAccessPoint = 7, ePc = 8, eServer = 9, ePrinter = 10, eWirelessRouter = 11, eIpPhone = 12, eDslModem = 13, eCableModem = 14, eRemoteNetwork = 15, eMultiLayerSwitch = 16, eSwitch3650 = 17, eLaptop = 18, eTabletPC = 19, ePda = 20, eWirelessEndDevice = 21, eWiredEndDevice = 22, eTV = 23, eHomeVoip = 24, eAnalogPhone = 25, eMultiUser = 26, eASA = 27, eIoE = 28, eHomeGateway = 29, eWirelessRouterNewGeneration = 30, eCellTower = 31, eCentralOfficeServer = 32, eCiscoAccessPoint = 33, eEmbeddedCiscoAccessPoint = 34, eSniffer = 35, eMCU = 36, eSBC = 37, eThing = 38, eMCUComponent = 39, eEmbeddedServer = 40, eWirelessLanController = 41, eCluster = 42, eGeoIcon = 43, eLightWeightAccessPoint = 44, ePowerDistributionDevice = 45, ePatchPanel = 46, eWallMount = 47, eSecurityAppliance = 48, eMerakiServer = 49

◆ getUpTime()

long Device::getUpTime ( )

Set time to the device.

Returns
vector<string>, vector of port names in string format

◆ getUsbPortAt()

UsbPort Device::getUsbPortAt ( int  )

Returns the usb port at a specified index.

Returns
int, index of the usb port

◆ getUsbPortCount()

int Device::getUsbPortCount ( )

Return the number of usb port.

Returns
int, number of usb port

◆ getUserDesktopAppAt()

UserDesktopAppConfig Device::getUserDesktopAppAt ( int  )

◆ getUserDesktopAppByDir()

UserDesktopAppConfig Device::getUserDesktopAppByDir ( string  )

◆ getUserDesktopAppById()

UserDesktopAppConfig Device::getUserDesktopAppById ( string  )

◆ getUserDesktopAppCount()

int Device::getUserDesktopAppCount ( )

◆ getXCoordinate()

double Device::getXCoordinate ( )

Returns the current x-coordinate position in the Logical workspace for this device.

Returns
double, the current x-coordinate.

◆ getXPhysicalWS()

int Device::getXPhysicalWS ( )

Returns the current x-coordinate position in the Physical workspace for this device.

Returns
int, the current x-cordinate.

◆ getYCoordinate()

double Device::getYCoordinate ( )

Returns the current y-coordinate position in the Logical workspace for this device.

Returns
double, the current y-coordinate.

◆ getYPhysicalWS()

int Device::getYPhysicalWS ( )

Returns the current y-coordinate position in the Physical workspace for this device.

Returns
int, the current y-coordinate.

◆ hasCustomVar()

bool Device::hasCustomVar ( QString  )

Returns true if this device has a custom variable with the specified name.

Parameters
name,thename of the variable of interest.
var,trueif this device has a custom variable with the specified name.

◆ isDesktopAvailable()

bool Device::isDesktopAvailable ( )

◆ isOutdated()

bool Device::isOutdated ( )

◆ isProjectRunning()

bool Device::isProjectRunning ( string  )

Checks if a programming project with the given name is running.

Parameters
projectName,Thename of the project to check is running. Something like "Blink (JavaScript)"
Returns
bool, value is true if the project was found running, false if not.

◆ moduleAdded()

void Device::moduleAdded ( ModuleType  ,
string  ,
string   
)

This event is emitted when a module is added.

  • type, the type of 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, eCustomModuleType = 2000
  • model, the model of the module.

IPC event.

◆ moduleRemoved()

void Device::moduleRemoved ( ModuleType  ,
string  ,
string   
)

This event is emitted when a module is removed.

  • type, the type of 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, eASAModule = 19, eASAPowerAdapter = 20
  • model, the model of the module.

IPC event.

◆ moveByInPhysicalWS()

bool Device::moveByInPhysicalWS ( int  ,
int   
)

Moves this device by the specified amount in Physical workspace.

Parameters
x,thex-amount to move by.
y,they-amount to move by.
Returns
bool, true if successful, otherwise false.

◆ moveToLocation()

bool Device::moveToLocation ( int  ,
int   
)

Moves this device to the specified location in Logical workspace.

Parameters
x,thenew x-coordinate position.
y,thenew y-coordinate position.
Returns
bool, true if successful, otherwise false.

◆ moveToLocationCentered()

bool Device::moveToLocationCentered ( int  ,
int   
)

Moves this device to the specified location for its center in Logical workspace.

Parameters
x,thenew x-coordinate position.
y,thenew y-coordinate position.
Returns
bool, true if successful, otherwise false.

◆ moveToLocInPhysicalWS()

bool Device::moveToLocInPhysicalWS ( int  ,
int   
)

Moves this device to the specified location in Physical workspace.

Parameters
x,thenew x-coordinate position.
y,thenew y-coordinate position.
Returns
bool, true if successful, otherwise false.

◆ nameChanged()

void Device::nameChanged ( QString  ,
QString   
)

IPC event.

This event is emitted when the display name is changed.

  • newName, the new name of this device.
  • oldName, the old name of this device.

◆ playSound()

void Device::playSound ( QString  ,
int   
)

Play sound to the device.

Parameters
soundID,theid of the sounpath to the sound file
numLoop,thenumber of times to play the sound

◆ portAdded()

void Device::portAdded ( string  )

This event is emitted when a port is added.

Parameters
portName,thename of the port that was added.

IPC event.

◆ portRemoved()

void Device::portRemoved ( string  )

This event is emitted when a port is removed.

Parameters
portName,thename of the port that was removed.

IPC event.

◆ portRemoving()

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.

Parameters
portName,thename of the port that is being removed.

IPC event.

◆ powerChanged()

void Device::powerChanged ( bool  )

IPC event.

This event is emitted when the power is changed.

  • on, the new power state.

◆ poweringOff()

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.

◆ relinkUserDesktopApp()

void Device::relinkUserDesktopApp ( string  ,
string   
)

◆ removeCustomVar()

bool Device::removeCustomVar ( QString  )

Removes a custom variable.

Parameters
name,thename of the variable.
Returns
bool, true if successful, otherwise, false.

◆ removeModule()

bool Device::removeModule ( string  )

Removes the module from the slot.

Parameters
slot,theslot to remove the module from.
Returns
bool, true if successful, otherwise false.

◆ removeUserDesktopApp()

void Device::removeUserDesktopApp ( string  )

◆ restoreToDefault()

bool Device::restoreToDefault ( bool  ,
bool   
)

◆ runCodeInProject()

bool Device::runCodeInProject ( string  ,
string   
)

Runs additional code in the given project.

Parameters
projectName,Thename of the project to run additional code in. Something like "Blink (JavaScript)"
code,thecode to run. If you were writing javascript you could output text like this. "Serial.println('testing output')"
Returns
bool, value is true if the project was found and the code was run, false if not.

◆ runProject()

bool Device::runProject ( string  ,
string   
)

Runs a programming project in the mcu.

Parameters
projectName,Thename of the project to run. Something like "Blink (JavaScript)"
extraCode,doesnothing.
Returns
bool, value is true if the project existed and was started, false if not.

◆ serializeToXml()

QString Device::serializeToXml ( )

Returns the serialization string of this device.

Parameters
QString,theserialization string of this device.

◆ setCustomInterface()

void Device::setCustomInterface ( QString  )

Set custom interface to the device.

Parameters
QString,thecustom interface name

◆ setCustomLogicalImage()

void Device::setCustomLogicalImage ( QString  )

Set custom logical image path.

Parameters
strPath,thepath to the custom logical image

◆ setCustomPhysicalImage()

void Device::setCustomPhysicalImage ( QString  )

Set custom physical image path.

Parameters
strPath,customphysical image name in string

◆ setDeviceExternalAttributes()

void Device::setDeviceExternalAttributes ( QString  )

Set device external attribute value.

Parameters
attributeValues,QStringattribute value pair in json format

◆ setName()

void Device::setName ( QString  )

Sets the display name of this device.

Parameters
name,thedisplay name string.

◆ setPower()

void Device::setPower ( bool  )

Sets the power on or off.

Parameters
bOn,trueto set the power on, false to set the power off.

◆ setTime()

void Device::setTime ( int  ,
int  ,
int  ,
int  ,
int  ,
int   
)

Set time to the device.

Parameters
iuHour,hourin integer
uiMin,minutein integer
uiSec,secondin integer
uiDay,dayin integer
uiMonth,monthin integer
uiYear,yearin integer

◆ stopProject()

bool Device::stopProject ( string  )

Stops a programming project in the mcu.

Parameters
projectName,Thename of the project to stop. Something like "Blink (JavaScript)"
Returns
bool, value is true if the project was found and stopped, false if not.

◆ stopSound()

void Device::stopSound ( QString  )

Stop playing sound on the device.

Parameters
soundID,theid of the sounpath to the sound file

◆ stopSounds()

void Device::stopSounds ( )

Stops playing all sounds on the device.

◆ subtractDeviceExternalAttributes()

void Device::subtractDeviceExternalAttributes ( QString  )

Remove some of the device external attribute value pairs from the current list.

Parameters
attributeValues,QStringattribute value pair in json format

◆ updateTemplateCreationTime()

void Device::updateTemplateCreationTime ( )

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