Packet Factory - Assemble packets¶
Smartglass packet factory
-
xbox.sg.factory.
_message_header
(msg_type, channel_id=0, target_participant_id=0, source_participant_id=0, is_fragment=False, need_ack=False)¶ Helper method for creating a message header.
- Parameters
msg_type (int) – The message type.
channel_id (int) – The target channel of the message.
target_participant_id (int) – The target participant Id.
source_participant_id (int) – The source participant Id.
is_fragment (bool) – Whether the message is a fragment.
need_ack (bool) – Whether the message needs an acknowledge.
- Returns
Instance of
:class:`XStructObj`
.- Return type
XStructObj
-
xbox.sg.factory.
power_on
(liveid)¶ Assemble PowerOn Request message.
- Parameters
liveid (str) – The console LiveId (extracted from the
DiscoveryResponse
Certificate).- Returns
Instance of
:class:`XStructObj`
.- Return type
XStructObj
-
xbox.sg.factory.
discovery
(client_type=<ClientType.Android: 8>)¶ Assemble DiscoveryRequest SimpleMessage.
- Parameters
client_type (
ClientType
) – Member ofClientType
, defaults to ClientType.Android.- Returns
Instance of
:class:`XStructObj`
.- Return type
XStructObj
-
xbox.sg.factory.
connect
(sg_uuid, public_key_type, public_key, iv, userhash, jwt, msg_num, num_start, num_end)¶ Assemble ConnectRequest SimpleMessage.
- Parameters
sg_uuid (UUID) – Client Uuid, randomly generated.
public_key_type (
PublicKeyType
) – Public Key Type.public_key (bytes) – Calculated Public Key, from
Crypto
.iv (bytes) – Initialization Vector for this encrypted message.
userhash (str) – Xbox Live Account userhash.
jwt (str) – Xbox Live Account JWT / Auth-token.
msg_num (int) – Current message number (important for fragmentation).
num_start (int) – Base number start of ConnectRequest fragments.
num_end (int) – Base number end of ConnectRequest fragments (base number start + total fragments + 1).
- Returns
Instance of
:class:`XStructObj`
.- Return type
XStructObj
-
xbox.sg.factory.
message_fragment
(msg_type, sequence_begin, sequence_end, data, **kwargs)¶ Assemble fragmented message.
-
xbox.sg.factory.
acknowledge
(low_watermark, processed_list, rejected_list, **kwargs)¶ Assemble acknowledgement message.
-
xbox.sg.factory.
json
(text, **kwargs)¶ Assemble JSON message.
- Parameters
text (str) – Text string.
- Returns
Instance of
:class:`XStructObj`
.- Return type
XStructObj
-
xbox.sg.factory.
disconnect
(reason, error_code, **kwargs)¶ Assemble Disconnect message.
- Parameters
reason (
xbox.sg.enum.DisconnectReason
) – Disconnect reason.error_code (int) – Error code.
- Returns
Instance of
:class:`XStructObj`
.- Return type
XStructObj
-
xbox.sg.factory.
power_off
(liveid, **kwargs)¶ Assemble PowerOff message.
- Parameters
liveid (str) – Live ID of console.
- Returns
Instance of
:class:`XStructObj`
.- Return type
XStructObj
-
xbox.sg.factory.
local_join
(client_info, **kwargs)¶ Assemble LocalJoin message.
- Parameters
client_info (object) – Instance of
WindowsClientInfo
orAndroidClientInfo
.- Returns
Instance of
:class:`XStructObj`
.- Return type
XStructObj
-
xbox.sg.factory.
title_launch
(location, uri, **kwargs)¶ Assemble TitleLaunch message.
- Parameters
location (
ActiveTitleLocation
) – Location.uri (str) – Uri string for title to launch.
- Returns
Instance of
:class:`XStructObj`
.- Return type
XStructObj
-
xbox.sg.factory.
start_channel
(channel_request_id, title_id, service, activity_id, **kwargs)¶ Assemble StartChannelRequest message.
-
xbox.sg.factory.
stop_channel
(channel_id, **kwargs)¶ Assemble StopChannel message.
- Parameters
channel_id (int) – Channel Id to stop.
- Returns
Instance of
:class:`XStructObj`
.- Return type
XStructObj
-
xbox.sg.factory.
gamepad
(timestamp, buttons, l_trigger, r_trigger, l_thumb_x, l_thumb_y, r_thumb_x, r_thumb_y, **kwargs)¶ Assemble gamepad input message.
- Parameters
timestamp (longlong) – Timestamp.
buttons (
GamePadButton
) – Bitmask of pressed gamepad buttons.l_trigger (float) – LT.
r_trigger (float) – RT.
l_thumb_x (float) – Position of left thumbstick, X-Axis.
l_thumb_y (float) – Position of left thumbstick, Y-Axis.
r_thumb_x (float) – Position of right thumbstick, X-Axis.
r_thumb_y (float) – Position of right thumbstick, Y-Axis.
- Returns
Instance of
:class:`XStructObj`
.- Return type
XStructObj
-
xbox.sg.factory.
unsnap
(unknown, **kwargs)¶ Assemble unsnap message.
- Parameters
unknown (int) – Unknown value.
- Returns
Instance of
:class:`XStructObj`
.- Return type
XStructObj
-
xbox.sg.factory.
game_dvr_record
(start_time_delta, end_time_delta, **kwargs)¶ Assemble Game DVR record message.
-
xbox.sg.factory.
media_command
(request_id, title_id, command, seek_position, **kwargs)¶ Assemble Media Command message.
-
xbox.sg.factory.
systemtext_input
(session_id, base_version, submitted_version, total_text_len, selection_start, selection_length, flags, text_chunk_byte_start, text_chunk, delta=None, **kwargs)¶ Assemble SystemText Input message
- Parameters
session_id (int) – Textt session Id
base_version (int) – Base version
submitted_version (int) – Submitted Version
total_text_len (int) – Total text length
selection_start (int) – Selection start
selection_length (int) – Selection length
flags (int) – Input flags
text_chunk_byte_start (int) – Start byte of text chunk
text_chunk (str) – Actual text to send
delta (NoneType) – Unknown
- Returns
Instance of
:class:`XStructObj`
.- Return type
XStructObj
-
xbox.sg.factory.
systemtext_ack
(session_id, text_version, **kwargs)¶ Assemble SystemText Acknowledge message
-
xbox.sg.factory.
systemtext_done
(session_id, text_version, flags, result, **kwargs)¶ Assemble SystemText Done message
-
xbox.sg.factory.
title_auxiliary_stream
(**kwargs)¶ Assemble Auxiliary Stream message
- Returns
Instance of
XStructObj
- Return type
XStructObj