Skip to content

MiraLib Python Library Listing

Specter edited this page May 13, 2020 · 1 revision

Below is a listing of all the functions and types provided by the Python 3 library for interacting with Mira and by extension the end PS4.

Module

All classes are grouped under the miralib module.

import miralib

Manage Class

The manage library is provided for handling all the low-level functionality of managing the console list for the PC, and exposes functionality for adding and removing consoles, getting a list of the currently added consoles, and managing the currently active console. For Python, this is the only subsystem provided, no UI library is currently provided.

Methods

GetListOfConsoles()

def GetListOfConsoles(self)

Returns a list of Console objects from the file-backed list of consoles added to the user's PC.

bool AddConsole(name, ip)

def AddConsole(self, name, ip)

Adds a console with the given name and ip to the file-backed list of consoles added to the user's PC. Returns whether or not the console could be added.

bool RemoveConsole()

def RemoveConsole(self, name)

Removes a console with the given name from the file-backed list of consoles added to the user's PC. Returns whether or not the console could be removed. If this returns false, it's likely the name given doesn't exist in the list.

SetCurrentConsole(console)

def SetCurrentConsole(self, console)

Sets the given console to the currently active console for all assist-based applications.

Console GetCurrentConsole()

def GetCurrentConsole(self)

Gets the currently active console as a Console object. Null if no active console was ever set.

Console Class

The Console class groups together all the data and functionality to manage console metadata, such as the name and IP address. It also includes functions to send and receive messages to the Mira server running on the PS4.

Members

Mira

Mira

The Mira member allows anyone holding the console object to access the MiraConnection class, which contains all the RPC endpoints for Mira's plugins, including debugging.

Methods

SetName(newName)

def SetName(self, newName)

Sets the console's name to the new name specified in newName.

bool SetIPAddress(ipString)

def SetIPAddress(self, ipString

Sets the console's IP address to the new IP formatted as a string in ipString. This should be in the format x.x.x.x. Returns true if the IP address passed is validated successfully, false otherwise.

string GetName()

def GetName(self)

Gets the console's current name.

string GetIPAddress()

def GetIPAddress(self)

Gets the console's current IP address as a string. This will be in the format x.x.x.x.

Connect()

def Connect(self)

Attempts to connect a new MiraConnection instance attached to the console to the PS4.

Disconnect()

def Disconnect(self)

Attempts to disconnect the established MiraConnection instance and nullifies it.

bool SendMessage(outgoingMessage)

def SendMessage(self, outgoingMessage)

Attempts to send a message to the PS4 through the established MiraConnection instance.

bool SendMessageExt(category, type, error, data)

def SendMessageExt(self, category, rpcType, errorCode, data)

Attempts to construct and send a message to the PS4 through the established MiraConnection instance.

RpcTransport SendMessageWithResponse(message)

def SendMessageWithResponse(self, message)

Attempts to send a message to the PS4 and receive a response from the established MiraConnection instance.

RpcTransport RecvMessage()

def RecvMessage(self)

Attempts to receive a message from the PS4 through the established MiraConnection instance.