Skip to content

Commit

Permalink
refactor: add SdkEarbudResult enum
Browse files Browse the repository at this point in the history
  • Loading branch information
timschneeb committed Aug 13, 2024
1 parent cdc719a commit 56c8774
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 10 deletions.
2 changes: 1 addition & 1 deletion GalaxyBudsClient/Message/Decoder/GenericEventDecoder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace GalaxyBudsClient.Message.Decoder;

[MessageDecoder(MsgIds.UNK_GENERIC_EVENT)]
[MessageDecoder(MsgIds.DEBUG_EVENT)]
public class GenericEventDecoder : BaseMessageDecoder
{
public Devices Device { get; }
Expand Down
4 changes: 2 additions & 2 deletions GalaxyBudsClient/Message/Decoder/GenericResponseDecoder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ namespace GalaxyBudsClient.Message.Decoder;
public class GenericResponseDecoder : BaseMessageDecoder
{
public MsgIds MessageId { get; }
public int ResultCode { get; }
public SdkEarbudResult ResultCode { get; }
public int? ExtraData { get; }

public GenericResponseDecoder(SppMessage msg) : base(msg)
{
MessageId = (MsgIds) msg.Payload[0];
ResultCode = msg.Payload[1];
ResultCode = (SdkEarbudResult) msg.Payload[1];
if (msg.Payload.Length > 2)
{
ExtraData = msg.Payload[2];
Expand Down
113 changes: 106 additions & 7 deletions GalaxyBudsClient/Message/SppMessageEnums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public enum MsgIds
UNKNOWN_39 = 39, // Buds+: disconnects device
DEBUG_BUILD_INFO = 40,
DEBUG_SERIAL_NUMBER = 41,
UNKNOWN_42 = 42,
ACC_SENSOR_LOGGING = 42,
UNKNOWN_43 = 43,
UNKNOWN_44 = 44,
TOUCH_ON_BUDS = 45,
Expand Down Expand Up @@ -109,8 +109,8 @@ public enum MsgIds
UNKNOWN_79 = 79,
RESET = 80,
RESP = 81,
UNK_CRASH = 82,
UNK_SHUTDOWN = 83,
REBOOT = 82,
POWEROFF = 83,
UNKNOWN_84 = 84,
UNKNOWN_85 = 85,
UNK_RF_TEST = 86,
Expand Down Expand Up @@ -243,7 +243,7 @@ public enum MsgIds
UNKNOWN_213 = 213,
UNK_BONDED_DEVICES = 214,
UNKNOWN_215 = 215,
UNKNOWN_216 = 216,
BLUETERM_TX_TRAFFIC = 216,
ADAPTIVE_EQ_VOLUME_CONTROL = 217,
ADAPTIVE_EQ_CONTROL = 218,
ADAPTIVE_EQ_STATUS = 219,
Expand All @@ -268,8 +268,8 @@ public enum MsgIds
UNKNOWN_238 = 238,
UNKNOWN_239 = 239,
UNKNOWN_240 = 240,
UNK_CRASH_REPORT = 241,
UNK_GENERIC_EVENT = 242,
DEBUG_ERROR_CODE = 241,
DEBUG_EVENT = 242,
UNKNOWN_243 = 243,
UNKNOWN_244 = 244,
UNKNOWN_245 = 245,
Expand Down Expand Up @@ -300,4 +300,103 @@ public enum MsgTypes
{
Request = 0,
Response = 1
}
}

[CompiledEnum]
public enum SdkEarbudResult
{
SUCCESS = 0,
FAILED = 1,
FATAL_ERROR = 2,
NO_RESOURCES = 3,
RESOURCE_BUSY = 4,
ERROR_TIMEOUT = 5,
NOT_FOUND = 6,
END_OF_STREAM = 7,
ALREADY_CREATED = 8,
INVALID_PARAMETER = 9,
IO_ERROR = 10,
UPDATE_INVALID_STATE = 11,
UPDATE_EXCEED_FILE_SIZE = 12,
UPDATE_FLASH_DRIVER_ERROR = 13,
UPDATE_FILE_NOT_FOUND = 14,
UPDATE_FAILED_TO_CHANGE_STATE = 15,
UPDATE_FAILED_TO_SET_LENGTH = 16,
UPDATE_FAILED_TO_SET_CRC32 = 17,
UPDATE_FAILED_TO_ERASE = 18,
UPDATE_FAILED_TO_WRITE_DATA = 19,
UPDATE_FAILED_DUPLICATE_CRC = 20,
UPDATE_INVALID_DATA_OFFSET = 21,
UPDATE_PEER_REQ_ABORT = 22,
INVALID_STATE = 23,
RESULT_PENDING = 24,
RESOURCE_CONGESTED = 25,
BACKGROUND = 26,
REJECT = 27,
APP_STATUS_BASE_CODE = 128,
APP_NOT_INITIALIZED = 129,
APP_INVALID_STATE = 130,
APP_INVALID_EVENT = 131,
APP_INVALID_OVERFLOW = 132,
APP_BRDG_NOT_YET_INIT_SYNC = 133,
APP_BRDG_INVALID_LPST_ROLE = 134,
APP_MSG_ALREADY_EXIST_MSGID = 135,
APP_MSG_NOT_EXIST_MSGID = 136,
APP_MSG_UNDEFINED_MSGID = 137,
APP_MSG_PENDING_MESSAGE = 138,
APP_IO_PACKET_ERROR = 139,
APP_CONN_NO_MGR_CONNECTION = 140,
APP_CONN_OVERFLOW_MTU = 141,
APP_CONN_CONGESTED = 142,
APP_CONN_LINKUP_LPST = 143,
APP_CONN_LINKDOWN_LPST = 144,
APP_CONN_LINKUP_MAIN_BREDR = 145,
APP_CONN_LINKDOWN_MAIN_BREDR = 146,
APP_CONN_LINKUP_GATT = 147,
APP_CONN_LINKDOWN_GATT = 148,
APP_SYS_MCU_BUSY_ACTIVE = 149,
APP_SYS_ALREADY_PROGRESSED = 150,
APP_SYS_NOT_PROGRESSING = 151,
APP_SYS_NOT_ALLOWED_PERMISSION = 152,
APP_SYS_NOT_REGISTERED_CB = 153,
APP_SYS_CRC_ERROR = 154,
APP_SYS_LOW_BATTERY = 155,
APP_SYS_TIMEOUT = 156,
APP_SYS_TIMEOUT_NOT_EXPIRED = 157,
APP_SYS_WAITING_EVENT = 158,
APP_SYS_UNEXPECTED_ROLE_SWITCH = 159,
APP_SYS_FAILED_ROLE_SWITCH = 160,
APP_SYS_FAILED_TEST = 161,
APP_PLACE_IN_CLOSE_CASE = 162,
APP_PLACE_IN_OPEN_CASE = 163,
APP_PLACE_IN_OUTSIDE = 164,
APP_PLACE_IN_EAR = 165,
APP_FOTA_ABORTED_BY_USER = 166,
APP_FOTA_NO_RESPONSE_FROM_MGR = 167,
APP_FOTA_DOWNLOADING = 168,
APP_FOTA_UPDATING = 169,
APP_UART_DOWNLOAD_AND_UPDATING = 170,
APP_DUPLICATED_PARAMETER = 171,
APP_PROCEEDING_SHUTDOWN = 172,
APP_LOGIC_TIMEOUT = 173,
APP_NOT_SUPPORT_PROTOCOL = 174,
APP_INVALID_FRAGMENT_PROTOCOL = 175,
APP_SYS_FILE_ALREADY_OPENED = 176,
APP_SYS_FILE_NOT_DOWNLOADABLE_STATE = 177,
APP_SYS_FILE_NOT_YET_FULL_DOWNLOAD = 178,
APP_SYS_FILE_FULL_DOWNLOADED = 179,
APP_SYS_FILE_INVALID_ID = 180,
APP_SYS_FILE_MISTMATCHED = 181,
APP_SYS_FILE_MISTMATCHED_WRITTEN_SIZE = 182,
APP_SYS_FILE_MISTMATCHED_CALCRC = 183,
APP_SYS_FILE_OVERFLOW_WRITTEN_SIZE = 184,
APP_SYS_FILE_WRITE_FULL = 185,
APP_SYS_FILE_COLLECTING_DATA = 186,
APP_SYS_FILE_COLLECTED_ALL_DATA = 187,
APP_SYS_FILE_COMPLTETE = 188,
APP_SYS_FILE_RECV_FULL = 189,
APP_SYS_FILE_NOT_RECV = 190,
APP_CONN_BT_ON = 191,
APP_CONN_BT_OFF = 192,
APP_STATUS_END_CODE = 256
}

0 comments on commit 56c8774

Please sign in to comment.