/// <summary> /// public method <c>SendMessage</c> attempts to construct and send a message to the PS4 through the established MiraConnection instance. /// </summary> /// <param name="p_Category">Category for the message.</param> /// <param name="p_Type">Type for the message.</param> /// <param name="p_Error">Error code.</param> /// <param name="p_Data">Endpoint specific data.</param> /// <returns>True if the message was sent, false otherwise.</returns> public bool SendMessage(RpcCategory p_Category, uint p_Type, long p_Error, byte[] p_Data) { if (Mira == null) { return(false); } return(Mira.SendMessage(p_Category, p_Type, p_Error, p_Data)); }
public static RpcCategory ToRpc(this Category category) { var rpcCategory = new RpcCategory() { Id = category.Id, Name = category.Name, Color = ColorTranslator.ToHtml(category.Color) }; if (category.Categories?.Count > 0) { rpcCategory.Categories.AddRange(category.Categories.Select(ToRpc)); } return(rpcCategory); }
public static Category FromRpc(this RpcCategory rpcCategory) { var category = new Category() { Id = rpcCategory.Id, Name = rpcCategory.Name, Color = ColorTranslator.FromHtml(rpcCategory.Color) }; if (rpcCategory.Categories?.Count > 0) { var categoryList = rpcCategory.Categories .Select(FromRpc) .ToList(); category.Categories = new ReadOnlyCollection <Category>(categoryList); } return(category); }
/// <summary> /// public method <c>SendMessage(category, type, error, data)</c> takes the given information and constructs an RpcTransport capsule and sends it to the PS4. /// </summary> /// <param name="p_Category">Category to send the message to.</param> /// <param name="p_Type">Type of message for that category.</param> /// <param name="p_Error">Error code.</param> /// <param name="p_Data">Endpoint specific data.</param> /// <returns>True if the message was sent, false otherwise.</returns> public bool SendMessage(RpcCategory p_Category, uint p_Type, long p_Error, byte[] p_Data) { // Create a capsule for the entire message var s_Transport = new RpcTransport { // Create the request header Header = new RpcHeader { Category = p_Category, Type = p_Type, Error = p_Error, IsRequest = true, Magic = c_HeaderMagic }, Data = ByteString.CopyFrom(p_Data) }; // Send it off return(SendMessage(s_Transport)); }