Esempio n. 1
0
 public BaseMessageParser BuildParser()
 {
     return(SPPMessageParserFactory.BuildParser(this));
 }
Esempio n. 2
0
        public void MessageReceiver(object sender, SPPMessage e)
        {
            BaseMessageParser parser = SPPMessageParserFactory.BuildParser(e);

            AnyMessageReceived?.Invoke(this, parser);
            switch (e.Id)
            {
            case SPPMessage.MessageIds.MSG_ID_RESET:
                ResetResponse?.Invoke(this, ((ResetResponseParser)parser).ResultCode);
                break;

            case SPPMessage.MessageIds.MSG_ID_FOTA_DEVICE_INFO_SW_VERSION:
                SwVersionResponse?.Invoke(this, ((SoftwareVersionOTAParser)parser).SoftwareVersion);
                break;

            case SPPMessage.MessageIds.MSG_ID_BATTERY_TYPE:
                BatteryTypeResponse?.Invoke(this, (BatteryTypeParser)parser);
                break;

            case SPPMessage.MessageIds.MSG_ID_AMBIENT_MODE_UPDATED:
                AmbientEnabledUpdateResponse?.Invoke(this, ((AmbientModeUpdateParser)parser).Enabled);
                break;

            case SPPMessage.MessageIds.MSG_ID_DEBUG_BUILD_INFO:
                BuildStringResponse?.Invoke(this, ((DebugBuildInfoParser)parser).BuildString);
                break;

            case SPPMessage.MessageIds.MSG_ID_DEBUG_GET_ALL_DATA:
                GetAllDataResponse?.Invoke(this, (DebugGetAllDataParser)parser);
                break;

            case SPPMessage.MessageIds.MSG_ID_DEBUG_SERIAL_NUMBER:
                SerialNumberResponse?.Invoke(this, (DebugSerialNumberParser)parser);
                break;

            case SPPMessage.MessageIds.MSG_ID_EXTENDED_STATUS_UPDATED:
                ExtendedStatusUpdate?.Invoke(this, (ExtendedStatusUpdateParser)parser);
                break;

            case SPPMessage.MessageIds.MSG_ID_FIND_MY_EARBUDS_STOP:
                FindMyGearStopped?.Invoke(this, null);
                break;

            case SPPMessage.MessageIds.MSG_ID_RESP:
                GenericResponse?.Invoke(this, (GenericResponseParser)parser);
                break;

            case SPPMessage.MessageIds.MSG_ID_SELF_TEST:
                SelfTestResponse?.Invoke(this, (SelfTestParser)parser);
                break;

            case SPPMessage.MessageIds.MSG_ID_SET_TOUCHPAD_OTHER_OPTION:
                OtherOption?.Invoke(this, ((SetOtherOptionParser)parser).OptionType);
                break;

            case SPPMessage.MessageIds.MSG_ID_STATUS_UPDATED:
                StatusUpdate?.Invoke(this, (StatusUpdateParser)parser);
                break;

            case SPPMessage.MessageIds.MSG_ID_USAGE_REPORT:
                UsageReport?.Invoke(this, (UsageReportParser)parser);
                break;

            case SPPMessage.MessageIds.MSG_ID_MUTE_EARBUD_STATUS_UPDATED:
                FindMyGearMuteUpdate?.Invoke(this, (MuteUpdateParser)parser);
                break;

            case SPPMessage.MessageIds.MSG_ID_ANC_STATUS_UPDATED:
                NoiseCancellingUpdated?.Invoke(this, ((NoiseCancellingUpdatedParser)parser).Enabled);
                break;
            }
        }