Kivy app crashes on Android when loading a video - kivy

I have created an app that uses a button to open a new screen that plays a video using kivy VideoPlayer. The app works fine on windows but when I run on Android, the app crashes when trying to open the screen where the video will be playing. Below is the logcat output right after the the crash. I could use help interpreting the log to determine what might be causing the crash.
01-09 20:38:33.731 1564 1733 I python : [ERROR ] [Image ] Error loading <Extra/Pics and Vids/Videos/db_shoulder_press.mp4>
01-09 20:38:33.788 1248 32081 D SemWifiUsabilityStatsMonitor: onWifiUsabilityStats - seqNum 21663, isSameBssidAndFreq true
01-09 20:38:33.789 1248 2120 D ConnectivityService: notifyType CALLBACK_CAP_CHANGED for [221 WIFI]
01-09 20:38:33.791 1248 2181 I SemWifiLinkQualityMonitor: Link Qos Query: 0.040 ms / 201.599 Mbps (866 / 0.030 / 1.009)
01-09 20:38:33.791 1248 2157 D SemWifiSwitchForIndividualAppsService: stopTCPMonitoring : already stopped
01-09 20:38:33.791 1248 2157 I WifiConnectivityMonitor.NCC: sNetworkCallback(oCC) FULL : 221[ Transports: WIFI Capabilities: NOT_METERED&INTERNET&NOT_RESTRICTED&TRUSTED&NOT_VPN&VALIDATED&NOT_ROAMING&FOREGROUND&NOT_CONGESTED&NOT_SUSPENDED&NOT_VCN_MANAGED LinkUpBandwidth>=22390Kbps LinkDnBandwidth>=47711Kbps TransportInfo: <SSID: <unknown ssid>, BSSID: 02:00:00:00:00:00, MAC: 02:00:00:00:00:00, IP: /10.0.0.50, Security type: 2, Supplicant state: COMPLETED, Wi-Fi standard: 5, RSSI: -47, Link speed: 866Mbps, Tx Link speed: 866Mbps, Max Supported Tx Link speed: 866Mbps, Rx Link speed: 650Mbps, Max Supported Rx Link speed: 866Mbps, Frequency: 5240MHz, Net ID: -1, Metered hint: false, score: 60, isUsable: true, CarrierMerged: false, SubscriptionId: -1, IsPrimary: 1, Trusted: true, Restricted: false, Ephemeral: false, OEM paid: false, OEM private: false, OSU AP: false, FQDN: <none>, Provider friendly name: <none>, Requesting package name: <none><none>MLO Information: , AP MLD Address: <none>, AP MLO Link Id: <none>, AP MLO Affiliated links: <none>> SignalStrength: -47 AdminUids: [1000] SSID: "The Holy Grail" UnderlyingNetworks: Null]
01-09 20:38:33.791 1248 2157 I WifiConnectivityMonitor.NCC: sNetworkCallback(oCC) (true/false)
01-09 20:38:33.793 1248 2197 I WifiConnectivityMonitor: current mode : 1
01-09 20:38:33.793 1248 2197 D OpenNetworkQos[4.00]: updateBssidNoInternet: mBssidNoInternet = false
01-09 20:38:33.793 1248 2197 D OpenNetworkQos[4.00]: getOpenNetworkQosNoInternetStatus: false
01-09 20:38:33.793 1248 2197 D OpenNetworkQos[4.00]: getOpenNetworkQosScores: 26 26 26
01-09 20:38:33.793 1248 2197 D SettingsProvider: isChangeAllowed() : name = wifi_wcm_qos_sharing_score_summary
01-09 20:38:33.794 5977 6939 I HBD : g onCapabilitiesChanged network : 221 current network state : wifi
01-09 20:38:33.794 1248 2197 I WifiProfileShare: network QoS data was changed (internet), updateQoSData networkType: true, qosData: false
01-09 20:38:33.794 1248 3480 V WifiProfileShare.Caster: update wips network, size: 0
01-09 20:38:33.794 1248 3480 D WifiProfileShare: nearby scanning settings run
01-09 20:38:33.794 1248 3480 D WifiProfileShare: network score provider settings enabled
01-09 20:38:33.794 1248 3480 D OpenNetworkQos[4.00]: getOpenNetworkQosScores: 26 26 26
01-09 20:38:33.794 1248 3480 D OpenNetworkQos[4.00]: getOpenNetworkQosNoInternetStatus: false
01-09 20:38:33.794 1248 3480 I WifiProfileShare.Caster: current network type: 0, score: [26, 26, 26]
01-09 20:38:33.795 1248 3480 V WifiProfileShare.Cache: update network score bc:5b:d5:fb:f2:74
01-09 20:38:33.795 1248 3480 D WifiProfileShare.ScanMatcher: getMcfDataList size:2
01-09 20:38:33.795 1248 3480 I WifiProfileShare.Caster: qos data was updated , before:type:QOS, pBssid:a0:27:c8, qosData:7c after:type:QOS, pBssid:a0:27:c8, qosData:7c
01-09 20:38:33.797 2398 2478 D NetworkController.WifiSignalController: notifyListener: visible=true, connected=true, inetCondition=1, isDefault=true, wifiTestReported=true, receivedInetCondition=-1, hideDuringMobileSwitching=false
01-09 20:38:33.797 26542 26556 I ChimeraSrvcProxy: NullBinder for android.net.action.RECOMMEND_NETWORKS triggering remote TransactionTooLargeException due to Service without Chimera impl
01-09 20:38:33.798 26542 26556 W .gms.persistent: Large reply transaction of 1056768 bytes, interface descriptor , code 1
01-09 20:38:33.799 1248 3480 I [MCFSDK_android_1.2.4010]_4_b: isNetworkEnabled - type : 1 ret : true
01-09 20:38:33.799 1248 3480 D WifiProfileShare.McfCast: -ME--- mIsNetworkEnabled :true
01-09 20:38:33.799 1248 3480 D WifiProfileShare.McfCast: updateQoSData ignored, same contents
01-09 20:38:33.799 1248 3480 D WifiProfileShare.MCF: success update QosData !
01-09 20:38:33.800 2379 3295 I LocationAccessPolicy: checkLocationPermission - callingUid: 10457, callingPid: 4066, resultForFine: DENIED_HARD
01-09 20:38:33.800 1248 3480 I [MCFSDK_android_1.2.4010]_4_b: isNetworkEnabled - type : 1 ret : true
01-09 20:38:33.800 1248 3480 D WifiProfileShare.McfCast: -ME--- mIsNetworkEnabled :true
01-09 20:38:33.800 1248 3480 D WifiProfileShare.McfCast: -ME--- updatePasswordDate pwdData size:2
01-09 20:38:33.801 2379 3295 I LocationAccessPolicy: checkLocationPermission - callingUid: 10457, callingPid: 4066, resultForCoarse: DENIED_HARD
01-09 20:38:33.801 2398 2478 D Tile.WifiTile: handleUpdateState isTransient=false transientEnabling =false cb.isTransient=false state.state = 2 mStateBeforeClick.value =false enabled =true
01-09 20:38:33.854 1564 2290 I AAudio : AAudioStreamBuilder_openStream() called ----------------------------------------
01-09 20:38:33.854 1564 2290 I AudioStreamBuilder: rate = 48000, channels = 2, channelMask = 0x80000003, format = 1, sharing = SH, dir = OUTPUT
01-09 20:38:33.854 1564 2290 I AudioStreamBuilder: device = 0, sessionId = -1, perfMode = 10, callback: OFF with frames = 0
01-09 20:38:33.854 1564 2290 I AudioStreamBuilder: usage = 0, contentType = 0, inputPreset = 0, allowedCapturePolicy = 0
01-09 20:38:33.854 1564 2290 I AudioStreamBuilder: privacy sensitive = false, opPackageName = (null), attributionTag = (null)
01-09 20:38:33.856 1564 2290 D AudioStreamBuilder: build() MMAP not used because AAUDIO_PERFORMANCE_MODE_LOW_LATENCY not requested.
01-09 20:38:33.856 1564 2290 D ercise.com.yhwh: PlayerBase::PlayerBase()
01-09 20:38:33.856 1564 2290 D AudioStreamTrack: open(), request notificationFrames = 0, frameCount = 0
01-09 20:38:33.856 1105 1786 D AudioFlinger: ro.audio.silent is ignored since no output device is set
01-09 20:38:33.856 1105 1769 D AudioFlinger: ro.audio.silent is ignored since no output device is set
01-09 20:38:33.858 1105 1800 D AudioFlinger: ro.audio.silent is ignored since no output device is set
01-09 20:38:33.858 1105 1788 D AudioFlinger: ro.audio.silent is ignored since no output device is set
01-09 20:38:33.859 1105 1801 D AudioFlinger: ro.audio.silent is ignored since no output device is set
01-09 20:38:33.862 1105 4395 V APM_AudioPolicyManager: getOutputForAttrInt() attributes={ Content type: AUDIO_CONTENT_TYPE_MUSIC Usage: AUDIO_USAGE_MEDIA Source: AUDIO_SOURCE_DEFAULT Flags: 0x400 Tags: } stream=AUDIO_STREAM_MUSIC session 35713 selectedDeviceId 0
01-09 20:38:33.862 1105 4395 I APM_AudioPolicyManager: selectOutputFlags: remove ULL flag for dolby
01-09 20:38:33.862 1105 4395 V APM_AudioPolicyManager: getOutputForAttrInt() device {AUDIO_DEVICE_OUT_SPEAKER, #:}, sampling rate 48000, format 0x1, channel mask 0x3, flags 0x8 stream AUDIO_STREAM_MUSIC
01-09 20:38:33.862 1105 4395 V APM_AudioPolicyManager: selectOutput new bestOutput 13 criteria 0 100 0 0 0 0 4 2
01-09 20:38:33.862 1105 4395 V APM_AudioPolicyManager: selectOutput new bestOutput 21 criteria 0 100 0 0 0 1 2 0
01-09 20:38:33.862 1105 4395 V APM_AudioPolicyManager: getOutputForAttrInt returns output 21 selectedDeviceId 3
01-09 20:38:33.862 1105 4395 V APM_AudioPolicyManager: getOutputForAttr() returns output 21 requestedPortId 0 selectedDeviceId 3 for port ID 4205
01-09 20:38:33.863 1105 4395 I AudioFlinger: nonSecFlag 0, secFlag 0, outputFlags 8
01-09 20:38:33.863 1105 4395 D AudioFlinger: Client defaulted notificationFrames to 1282 for frameCount 3848
01-09 20:38:33.863 1564 1733 F libc : Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0 in tid 1733 (SDLThread), pid 1564 (SDLActivity)
01-09 20:38:33.865 1105 4395 D AF::TrackHandle: OpPlayAudio: track:3434 usage:1 not muted
01-09 20:38:33.866 1105 4395 I AF::Track: setMixerOutConfig expectKey 202
01-09 20:38:33.866 1105 4395 I AF::Track: setMixerOutConfig select, mixer out f 5, s 48000, thread out f 4, s 48000
01-09 20:38:33.877 1564 2290 D AudioTrack: setVolume(1.000000, 1.000000) pid : 1564
01-09 20:38:33.877 1564 2290 D AAudioStream: setState(s#1) from 0 to 2
01-09 20:38:33.879 1564 2290 I AAudio : AAudioStreamBuilder_openStream() returns 0 = AAUDIO_OK for s#1 ----------------
01-09 20:38:33.879 1564 2290 D AAudio : AAudioStream_requestStart(s#1) called --------------
01-09 20:38:33.879 1564 2290 D AAudioStream: setState(s#1) from 2 to 3
01-09 20:38:33.879 1105 4395 I AF::Track: setMixerOutConfig expectKey 202
01-09 20:38:33.879 1105 4395 I AF::Track: setMixerOutConfig select, mixer out f 5, s 48000, thread out f 4, s 48000
01-09 20:38:33.879 1105 4395 I AudioPolicyEffectException: MySpaceHandler::checkDetachCondition media 1, ring 0, mp 0
01-09 20:38:33.879 1105 4395 I AudioPolicyEffectException: MySpace detach value 1
01-09 20:38:33.879 1105 4395 V APM_AudioPolicyManager: startOutput portId 4205
01-09 20:38:33.879 1105 4395 V APM_AudioPolicyManager: startOutput() output 21, stream 3, session 35713
01-09 20:38:33.879 1105 4395 V APM_AudioPolicyManager: setBeaconMute(1) mBeaconMuteRefCount=26 mBeaconPlayingRefCount=0
01-09 20:38:33.879 1105 4395 V APM_AudioPolicyManager: selectOutputForMusicEffects activeOnly 1 output 21 flags 0x00000008
01-09 20:38:33.879 1105 4395 W AudioFlinger: moveEffectChain_l() effect chain for session 0 not on source thread 0xb4000079bd440850
01-09 20:38:33.879 1105 4395 V APM_AudioPolicyManager: selectOutputForMusicEffects selected output 21
01-09 20:38:33.879 1105 4395 V APM_AudioPolicyManager: getNewOutputDevices selected devices {AUDIO_DEVICE_OUT_SPEAKER, #:}
01-09 20:38:33.879 1105 4395 V APM_AudioPolicyManager: setOutputDevices device {AUDIO_DEVICE_OUT_SPEAKER, #:} delayMs 0
01-09 20:38:33.879 1105 4395 V APM_AudioPolicyManager: setOutputDevices() prevDevice {AUDIO_DEVICE_OUT_SPEAKER, #:}
01-09 20:38:33.879 1105 4395 V APM_AudioPolicyManager: setOutputDevices: suppressing checkDeviceMuteStrategies
01-09 20:38:33.879 1105 4395 V APM_AudioPolicyManager: setOutputDevices setting same device {AUDIO_DEVICE_OUT_SPEAKER, #:} or null device, force=0, patch handle=4134
01-09 20:38:33.879 1105 4395 V APM_AudioPolicyManager: computeVolume: stream 3, index 7, volume 0.050119, deviceTypes 0x2
01-09 20:38:33.879 1105 4395 V APM_AudioPolicyManager: computeVolume: stream 3, index 8, volume 0.070795, deviceTypes 0x2
01-09 20:38:33.881 989 1812 V sec_audio_hw: sec_dev_set_parameters : l_stream_music_active=true
01-09 20:38:33.881 989 1812 D audio_hw_primary: adev_set_parameters: enter: l_stream_music_active=true
01-09 20:38:33.881 989 1812 D audio_hw_hfp: hfp_set_parameters: enter
01-09 20:38:33.881 989 1812 V audio_hw_sec: sec_set_parameters: enter: l_stream_music_active=true
01-09 20:38:33.881 989 1812 D AudioSAEffectOffload: update offload effect: VM,0,0,0,0,2,0
01-09 20:38:33.881 989 1812 D audio_hw_extn: audio_extn_fm_set_parameters: Enter
01-09 20:38:33.881 989 1812 D audio_hw_primary: adev_set_parameters: exit with code(0)
01-09 20:38:33.881 989 1048 I Audio_a2dpsink_hw: adev_set_parameters: kevpairs=[l_stream_music_active=true]
01-09 20:38:33.882 1105 4395 I AudioFlinger: updateStageIndex new -2108
01-09 20:38:33.882 1105 1781 D DlbEffectContext: setParam() received parameter EFFECT_PARAM_SEEK
01-09 20:38:33.882 1105 1781 D DlbEffectContext: handleSeek(end crossfading for seeking operation)
01-09 20:38:33.882 1105 1781 D DlbCrossfadeProcess: setEnabled transitioning from FADE_TO_BYPASS state to FADE_TO_ACTIVE
01-09 20:38:33.882 1105 1781 D DlbEffectContext: transformExternalGain() volume:0xCD494 fVol:0.050119 extVal:-416
01-09 20:38:33.882 1105 1781 D DlbEffectContext: transformExternalGain() volume:0x1000000 fVol:1.000000 extVal:0
01-09 20:38:33.882 1105 1781 D DlbEndpointParamCache: commitChangedParams()
01-09 20:38:33.882 1105 1781 D DlbEndpointParamCache: commit() Applying parameters for device 0x40000000
01-09 20:38:33.882 1105 1781 D DlbDap2Process: setParam(preg = #1[0])
01-09 20:38:33.882 1105 1781 D DlbDap2Process: setSystemGain(vol = 0)
01-09 20:38:33.882 1105 1781 D DlbDap2Process: setParam(svol = #1[-416])
01-09 20:38:33.882 1105 1781 D DlbEndpointParamCache: doCommit() Committed 2 parameters out of 15.
01-09 20:38:33.882 1105 1781 D DlbEndpointParamCache: commit() Overriding parameters for current device 0x00000002
01-09 20:38:33.882 1105 1781 D DlbEndpointParamCache: doCommit() Committed 0 parameters out of 56.
01-09 20:38:33.882 1105 1781 I AudioSAEffectSecPlus: command EFFECT_CMD_SET_VOLUME left = 0.050119, right =0.050119
01-09 20:38:33.882 1564 2290 D AAudio : AAudioStream_requestStart(s#1) returned 0 ---------
01-09 20:38:33.882 1564 2315 D AudioStreamLegacy: onAudioDeviceUpdate(deviceId = 3)
01-09 20:38:33.883 1105 1781 D DlbCrossfadeProcess: process transitioning from FADE_TO_ACTIVE state to DAP_ACTIVE
01-09 20:38:33.883 1105 1781 I SoundAlive_Interface a64: [ 2 ][ 48000 ]FlushBuffers()
01-09 20:38:33.883 989 28053 D audio_hw_primary: start_output_stream: enter: stream(0xea58c970)usecase(0: deep-buffer-playback) devices(0x2) is_haptic_usecase(0)
01-09 20:38:33.884 989 28053 D audio_hw_primary: select_devices for use case (deep-buffer-playback)
01-09 20:38:33.884 989 28053 I sm8250_platform: platform_check_and_set_codec_backend_cfg:becf: afe: bitwidth 24, samplerate 48000 channels 2, backend_idx 0 usecase = 0 device (speaker)
01-09 20:38:33.884 989 28053 D sm8250_platform: platform_split_snd_device: snd_device(2) num devices(1) new_snd_devices(0)
01-09 20:38:33.884 989 28053 I sm8250_platform: platform_check_and_set_codec_backend_cfg: new_snd_devices[0] is 2
01-09 20:38:33.884 989 28053 I sm8250_platform: platform_check_codec_backend_cfg:becf: afe: bitwidth 24, samplerate 48000 channels 2, backend_idx 0 usecase = 0 device (speaker)
01-09 20:38:33.884 989 28053 D sm8250_platform: platform_check_codec_backend_cfg:becf: updated afe: bitwidth 24, samplerate 48000 channels 2,backend_idx 0 usecase = 0 device (speaker)
01-09 20:38:33.884 989 28053 D sm8250_platform: platform_check_codec_backend_cfg:becf: afe: playback on codec device not supporting native playback set default Sample Rate(48k)
01-09 20:38:33.884 989 28053 I sm8250_platform: platform_check_codec_backend_cfg:becf: afe: Codec selected backend: 0 updated bit width: 24 and sample rate: 48000
01-09 20:38:33.884 989 28053 D audio_hw_primary: check_usecases_codec_backend:becf: force routing 1
01-09 20:38:33.884 989 28053 E sm8250_platform: platform_check_backends_match: Invalid snd_device =
01-09 20:38:33.884 989 28053 D audio_hw_primary: check_usecases_codec_backend:becf: (81) check_usecases curr device: speaker, usecase device: backends match 0
01-09 20:38:33.884 989 28053 D audio_hw_primary: check_usecases_codec_backend:becf: check_usecases num.of Usecases to switch 0
01-09 20:38:33.884 989 28053 D hardware_info: hw_info_append_hw_type : device_name = speaker
01-09 20:38:33.884 989 28053 V audio_hw_sec: sec_dsm_spkr_prot_control_tx_topology() enable:1, dsm_is_enabled:0
01-09 20:38:33.884 989 28053 D hardware_info: hw_info_append_hw_type : device_name = vi-feedback
01-09 20:38:33.884 989 28053 D audio_hw_primary: enable_snd_device: snd_device(299: vi-feedback)
01-09 20:38:33.884 989 28053 D sm8250_platform: platform_get_island_cfg_on_device:island cfg status on snd_device = (vi-feedback 0)
01-09 20:38:33.884 989 28053 I soundtrigger: audio_extn_sound_trigger_update_device_status: device 0x12b of type 1 for Event 1, with Raise=0
01-09 20:38:33.884 989 28053 D audio_route: Apply path: vi-feedback
01-09 20:38:33.884 989 28053 D soundtrigger: audio_extn_sound_trigger_update_stream_status: uc_info->id 79 of type 1 for Event 3, with Raise=0
01-09 20:38:33.884 989 28053 D audio_hw_utils: audio_extn_utils_send_app_type_cfg: usecase->in_snd_device vi-feedback
01-09 20:38:33.884 989 28053 E voice : voice_is_in_call_rec_stream: input stream is NULL
01-09 20:38:33.884 989 28053 D sm8250_platform: platform_split_snd_device: snd_device(299) num devices(0) new_snd_devices(0)
01-09 20:38:33.884 989 28053 E voice : voice_is_in_call_rec_stream: input stream is NULL
01-09 20:38:33.884 989 28053 I audio_hw_utils: send_app_type_cfg_for_device default app_type 69938, acdb_dev_id 102, sample_rate 48000, snd_device_be_idx 56
01-09 20:38:33.885 989 28053 D sm8250_platform: platform_split_snd_device: snd_device(299) num devices(1) new_snd_devices(0)
01-09 20:38:33.885 989 28053 D ACDB-LOADER: ACDB -> send_audio_cal, acdb_id = 102, path = 1, app id = 0x11132, sample rate = 48000, afe_sample_rate = 48000
01-09 20:38:33.885 989 28053 D ACDB-LOADER: ACDB -> send_asm_topology
01-09 20:38:33.885 989 28053 D ACDB-LOADER: ACDB -> ACDB_CMD_GET_AUDPROC_STREAM_TOPOLOGY_ID
01-09 20:38:33.885 989 28053 D ACDB-LOADER: ACDB -> send_adm_topology
01-09 20:38:33.885 989 28053 D ACDB-LOADER: ACDB -> ACDB_CMD_GET_AUDPROC_COMMON_TOPOLOGY_ID
01-09 20:38:33.885 989 28053 D ACDB-LOADER: ACDB -> send_audtable
01-09 20:38:33.885 989 28053 D ACDB-LOADER: ACDB -> ACDB_CMD_GET_AUDPROC_INSTANCE_COMMON_TABLE_SIZE
01-09 20:38:33.885 989 28053 D ACDB-LOADER: ACDB -> ACDB_CMD_GET_AUDPROC_INSTANCE_COMMON_TABLE
01-09 20:38:33.885 989 28053 D ACDB-LOADER: ACDB -> AUDIO_SET_AUDPROC_CAL cal_type[11] acdb_id[102] app_type[69938]
01-09 20:38:33.885 989 28053 D ACDB-LOADER: ACDB -> ACDB_CMD_GET_PERSISTENT_AUDPROC_INSTANCE_COMMON_TABLE_SIZE
01-09 20:38:33.885 989 28053 D android.hardware.audio.service: [Data Manager]-> No data found
01-09 20:38:33.885 989 28053 D ACDB-LOADER: Error: ACDB_CMD_GET_PERSISTENT_AUDPROC_INSTANCE_COMMON_TABLE_SIZE returned -18
01-09 20:38:33.885 989 28053 D ACDB-LOADER: ACDB -> send_audproc_persist_table -18
01-09 20:38:33.885 989 28053 D ACDB-LOADER: Error: Invalid Audproc persist size = -18
01-09 20:38:33.885 989 28053 D ACDB-LOADER: ACDB -> ACDB_CMD_GET_AUDPROC_INSTANCE_STREAM_TABLE_SIZE
01-09 20:38:33.885 989 28053 D ACDB-LOADER: ACDB -> send_audstrmtable
01-09 20:38:33.885 989 28053 D ACDB-LOADER: ACDB -> ACDB_CMD_GET_AUDPROC_INSTANCE_STREAM_TABLE
01-09 20:38:33.885 989 28053 D ACDB-LOADER: ACDB -> audstrm_cal->cal_type.cal_data.cal_size = 20
01-09 20:38:33.885 989 28053 D ACDB-LOADER: ACDB -> send_afe_topology
01-09 20:38:33.885 989 28053 D ACDB-LOADER: ACDB -> ACDB_CMD_GET_AFE_TOPOLOGY_ID
01-09 20:38:33.885 989 28053 D ACDB-LOADER: ACDB -> GET_AFE_TOPOLOGY_ID for adcd_id 102, Topology Id 112fb
01-09 20:38:33.885 989 28053 D ACDB-LOADER: ACDB -> send_afe_cal
01-09 20:38:33.885 989 28053 D ACDB-LOADER: ACDB -> ACDB_CMD_GET_AFE_INSTANCE_COMMON_TABLE_SIZE
01-09 20:38:33.885 989 28053 D android.hardware.audio.service: Failed to fetch the lookup information of the device 00000066
01-09 20:38:33.885 989 28053 D ACDB-LOADER: Error: ACDB_CMD_GET_AFE_INSTANCE_COMMON_TABLE_SIZE Returned = -19
01-09 20:38:33.885 989 28053 D ACDB-LOADER: ACDB -> ACDB_CMD_GET_AFE_INSTANCE_COMMON_TABLE
01-09 20:38:33.885 989 28053 D android.hardware.audio.service: Failed to fetch the lookup information of the device 00000066
01-09 20:38:33.885 989 28053 D ACDB-LOADER: Error: ACDB AFE returned = -19
01-09 20:38:33.885 989 28053 D ACDB-LOADER: ACDB -> AUDIO_SET_AFE_CAL cal_type[17] acdb_id[102]
01-09 20:38:33.885 989 28053 D ACDB-LOADER: ACDB -> send_hw_delay : acdb_id = 102 path = 1
01-09 20:38:33.885 989 28053 D ACDB-LOADER: ACDB -> ACDB_AVSYNC_INFO: ACDB_CMD_GET_DEVICE_PROPERTY
01-09 20:38:33.885 989 28053 D audio_hw_primary: enable_audio_route: apply mixer and update path: spkr-vi-feedback
01-09 20:38:33.885 989 28053 D audio_route: Apply path: spkr-vi-feedback
01-09 20:38:33.885 989 28053 D AudioSAEffectOffload: update offload effect: VM,0,0,0,0,2,0
01-09 20:38:33.886 1248 2143 D AS.SoundAliveHelper: notify dvfs state : 2, screen : true
01-09 20:38:33.886 1248 1248 D AudioPlayerStateMonitor: Found a new active media playback. AudioPlaybackConfiguration piid:28015 deviceId:3 type:AAudio u/pid:10266/1564 state:started attr:AudioAttributes: usage=USAGE_MEDIA content=CONTENT_TYPE_UNKNOWN flags=0x0 tags= bundle=null sessionId:-1
01-09 20:38:33.890 31579 31622 I SAContentProvider: getType() : screen on is true
01-09 20:38:33.895 5977 5977 I HBD : g onCapabilityChanged setNetworkState currentNetworkState : wifi
01-09 20:38:33.896 1248 1248 I GestureDetector: handleMessage TAP
01-09 20:38:33.896 1248 1546 I GestureDetector: handleMessage TAP
01-09 20:38:33.905 989 28053 V audio_hw_sec: sec_dsm_spkr_prot_control_tx_topology() dsm enabled (c:0 d:1 m:0)
01-09 20:38:33.905 989 28053 D audio_hw_primary: enable_snd_device: snd_device(2: dual-speaker)
01-09 20:38:33.905 989 28053 D sm8250_platform: platform_get_island_cfg_on_device:island cfg status on snd_device = (speaker 0)
01-09 20:38:33.905 989 28053 I soundtrigger: audio_extn_sound_trigger_update_device_status: device 0x2 of type 0 for Event 1, with Raise=0
01-09 20:38:33.905 989 28053 D audio_route: Apply path: dual-speaker
01-09 20:38:33.910 989 28053 I audio_hw_utils: set_app_type_cfg app_type_cfg->app_type 69940 -> 69941 sample_rate 48000, bit_width 24
01-09 20:38:33.910 989 28053 I audio_hw_utils: set_app_type_cfg app_type_cfg->app_type 69941, app_type_cfg->sample_rate 48000, app_type_cfg->bit_width 24
01-09 20:38:33.910 989 28053 E soundtrigger: audio_extn_sound_trigger_update_stream_status: invalid input device 0x0, for event 3
01-09 20:38:33.910 989 28053 D soundtrigger: audio_extn_sound_trigger_update_stream_status: uc_info->id 0 of type 0 for Event 3, with Raise=0
01-09 20:38:33.910 989 28053 D audio_hw_utils: audio_extn_utils_send_app_type_cfg: usecase->out_snd_device speaker
01-09 20:38:33.910 989 28053 D sm8250_platform: platform_split_snd_device: snd_device(2) num devices(0) new_snd_devices(0)
01-09 20:38:33.910 989 28053 I audio_hw_utils: send_app_type_cfg_for_device PLAYBACK app_type 69941, acdb_dev_id 13, sample_rate 48000, snd_device_be_idx 55
01-09 20:38:33.910 989 28053 D sm8250_platform: platform_split_snd_device: snd_device(2) num devices(1) new_snd_devices(0)
01-09 20:38:33.910 989 28053 D ACDB-LOADER: ACDB -> send_audio_cal, acdb_id = 13, path = 0, app id = 0x11135, sample rate = 48000, afe_sample_rate = 48000
01-09 20:38:33.910 989 28053 D ACDB-LOADER: ACDB -> send_asm_topology
01-09 20:38:33.910 989 28053 D ACDB-LOADER: ACDB -> ACDB_CMD_GET_AUDPROC_STREAM_TOPOLOGY_ID
01-09 20:38:33.910 989 28053 D ACDB-LOADER: ACDB -> send_adm_topology
01-09 20:38:33.910 989 28053 D ACDB-LOADER: ACDB -> ACDB_CMD_GET_AUDPROC_COMMON_TOPOLOGY_ID
01-09 20:38:33.910 989 28053 D ACDB-LOADER: ACDB -> send_audtable
01-09 20:38:33.910 989 28053 D ACDB-LOADER: ACDB -> ACDB_CMD_GET_AUDPROC_INSTANCE_COMMON_TABLE_SIZE
01-09 20:38:33.910 989 28053 D ACDB-LOADER: ACDB -> ACDB_CMD_GET_AUDPROC_INSTANCE_COMMON_TABLE
01-09 20:38:33.910 989 28053 D ACDB-LOADER: ACDB -> AUDIO_SET_AUDPROC_CAL cal_type[11] acdb_id[13]
I have tried clearing the app cache on android which seemed to work at first but has since stopped preventing the crash.

Related

Grouping Columns in Deedle

Given a frame:Frame<(string * int * int),int>
let df =
[ (("N1", 100,1), "C1", 1.0); (("N2",100,2), "C1", 3.1)
(("N3",100,3), "C1", 4.0); (("N4",100,4), "C1", -6.4);
(("N1", 200,5), "C2", 1.0); (("N2",200,6), "C2", 7.1)
(("N3",200,7), "C2", 4.0); (("N4",200,8), "C2", -2.4);
(("N1", 100,1), "C2", 1.0); (("N2",100,2), "C2", 5.1)
(("N3",100,3), "C2", 4.0); (("N4",100,4), "C2", -8.4);
(("N1", 200,5), "C1", 1.0); (("N2",200,6), "C1", 1.1)
(("N3",200,7), "C1", 4.0); (("N4",200,8), "C1", -9.4)]
|> Frame.ofValues
I'd like to be able to group the columns by the second item in the Row Key tuple - so by 100 and 200 and then change the frame to Frame<(string*int),(int*int)>
It seems like I have to use Frame.Transpose and then Frame.groupRowsUsing to group the columns but I'm at a loss of how to get the 100/200 in the selector function.
Output should look like:
(100,C1) (100,C2) (200,C1) (200,C2)
N1 1 -> 1 1 1 1
N2 2 -> 3.1 5.1 1.1 7.1
N3 3 -> 4 4 4 4
N4 4 -> -6.4 -8.4 -9.4 -2.4
It was not clear to me if the intent was to keep the column keys as they are and change the row values to tuples or if the columns were supposed to be tuples and the values to remain as floats.
Assuming the first option:
//adding a helper function to the module: transforms row data and replace a given columns
module Frame =
let mapiReplaceCol col f frame = frame |> Frame.replaceCol col (Frame.mapRows f frame)
(df,df.ColumnKeys)
||> Seq.fold (fun acc elem ->
acc |> Frame.mapiReplaceCol elem (fun (_,k,_) row -> k,row.GetAs<float>(elem)))
|> Frame.mapRowKeys (fun (a,_,c) -> a,c)
(*output:
C1 C2
N1 100 1 -> (100, 1) (100, 1)
N2 100 2 -> (100, 3.1) (100, 5.1)
N3 100 3 -> (100, 4) (100, 4)
N4 100 4 -> (100, -6.4) (100, -8.4)
N1 200 5 -> (200, 1) (200, 1)
N2 200 6 -> (200, 1.1) (200, 7.1)
N3 200 7 -> (200, 4) (200, 4)
N4 200 8 -> (200, -9.4) (200, -2.4)
*)
Assuming the second option:
Step 1: descontructing the Frame to (row * col * value) and reconstructing
let step1 =
df |> Frame.mapRows (fun (a,b,c) row ->
df.ColumnKeys |> Seq.map (fun col ->(a,c),(b,col),row.GetAs<float>(col)))
|> Series.values |> Seq.concat |> Frame.ofValues
(*
output:
100 200
C1 C2 C1 C2
N1 1 -> 1 1 <missing> <missing>
5 -> <missing> <missing> 1 1
N2 2 -> 3,1 5,1 <missing> <missing>
6 -> <missing> <missing> 1,1 7,1
N3 3 -> 4 4 <missing> <missing>
7 -> <missing> <missing> 4 4
N4 4 -> -6,4 -8,4 <missing> <missing>
8 -> <missing> <missing> -9,4 -2,4
*)
Step 2: reducing levels
let step2 = step1 |> Frame.reduceLevel fst (fun (a : float) b -> a + b)
(*
output:
100 200
C1 C2 C1 C2
N1 -> 1 1 1 1
N2 -> 3,1 5,1 1,1 7,1
N3 -> 4 4 4 4
N4 -> -6,4 -8,4 -9,4 -2,4
*)
Step 3 (optional): reacreating the tuples in the index
let step3 = step2 |> Frame.mapRowKeys (fun k -> k,k.Replace("N","") |> int)
(*
output:
100 200
C1 C2 C1 C2
N1 1 -> 1 1 1 1
N2 2 -> 3,1 5,1 1,1 7,1
N3 3 -> 4 4 4 4
N4 4 -> -6,4 -8,4 -9,4 -2,4
*)
Basically, we reconstructed the frame from scratch. Maybe a better approach would be to change how the original frame is being constructed instead of doing all this.

blkparse how to show IO Scheduler message

blktrace version v2.0.0
note: in blkparse output, the m in the sixth column indicate the line is scheduler information.
On Ubuntu 16.04 ext4 I can see the IO Scheduler message, blktrace -d /dev/sda -o - | blkparse -i -
8,0 3 1 0.000000000 24714 A WS 76519424 + 2048 <- (8,1) 76517376
8,0 3 2 0.000000861 24714 Q WS 76519424 + 2048 [TaskSchedulerFo]
8,0 3 3 0.000005084 24714 X WS 76519424 / 76520768 [TaskSchedulerFo]
8,0 3 4 0.000008962 24714 G WS 76519424 + 1344 [TaskSchedulerFo]
8,0 3 5 0.000009379 24714 P N [TaskSchedulerFo]
8,0 3 6 0.000012021 24714 G WS 76520768 + 704 [TaskSchedulerFo]
8,0 3 7 0.000012622 24714 I WS 76519424 + 1344 [TaskSchedulerFo]
8,0 3 0 0.000015209 0 m N cfq24714SN /user.slice insert_request
8,0 3 0 0.000016074 0 m N cfq24714SN /user.slice add_to_rr
8,0 3 0 0.000017548 0 m N cfq24714SN /user.slice preempt
8,0 3 0 0.000018184 0 m N cfq25055SN /user.slice slice expired t=1
8,0 3 0 0.000018982 0 m N cfq25055SN /user.slice resid=-2643710186
8,0 3 0 0.000020125 0 m N /user.slice served: vt=247310740068 min_vt=247310580285
8,0 3 0 0.000021297 0 m N cfq25055SN /user.slice sl_used=33325195 disp=13 charge=13 iops=1 sect=1088
8,0 3 0 0.000021822 0 m N cfq25055SN /user.slice del_from_rr
8,0 3 0 0.000023767 0 m N cfq workload slice:100000000
8,0 3 0 0.000024496 0 m N cfq24714SN /user.slice set_active wl_class:0 wl_type:1
8,0 3 0 0.000025395 0 m N cfq24714SN /user.slice dispatch_insert
8,0 3 0 0.000026232 0 m N cfq24714SN /user.slice dispatched a request
8,0 3 0 0.000026818 0 m N cfq24714SN /user.slice activate rq, drv=1
8,0 3 8 0.000027030 24714 D WS 76519424 + 1344 [TaskSchedulerFo]
8,0 3 9 0.000037848 24714 U N [TaskSchedulerFo] 1
8,0 3 10 0.000038118 24714 P N [TaskSchedulerFo]
8,0 3 11 0.000048153 24714 A WS 76521472 + 264 <- (8,1) 76519424
8,0 3 12 0.000048340 24714 Q WS 76521472 + 264 [TaskSchedulerFo]
8,0 3 13 0.000049444 24714 M WS 76521472 + 264 [TaskSchedulerFo]
8,0 3 14 0.000050486 24714 I WS 76520768 + 968 [TaskSchedulerFo]
8,0 3 0 0.000051332 0 m N cfq24714SN /user.slice insert_request
8,0 3 15 0.000051755 24714 U N [TaskSchedulerFo] 1
8,0 3 0 0.000052418 0 m N cfq24714SN /user.slice dispatch_insert
8,0 3 0 0.000053068 0 m N cfq24714SN /user.slice dispatched a request
8,0 3 0 0.000053604 0 m N cfq24714SN /user.slice activate rq, drv=2
8,0 3 16 0.000053721 24714 D WS 76520768 + 968 [TaskSchedulerFo]
8,0 2 1 0.001844211 0 C WS 76519424 + 1344 [0]
8,0 2 0 0.001849143 0 m N cfq24714SN /user.slice complete rqnoi
on CentOS 7.4 xfs,I can not see the IO Scheduler message, blktrace -d /dev/sdb -o - | blkparse -i -
8,16 25 1 0.000000000 11966 Q R 73400472 + 128 [fio]
8,16 25 2 0.000006237 11966 G R 73400472 + 128 [fio]
8,16 25 3 0.000007806 11966 P N [fio]
8,16 25 4 0.000010836 11966 I R 73400472 + 128 [fio]
8,16 25 5 0.000011878 11966 U N [fio] 1
8,16 25 6 0.000013900 11966 D R 73400472 + 128 [fio]
8,16 10 1 0.008284979 0 C R 73400472 + 128 [0]
8,16 10 2 0.008343574 11966 Q R 73400600 + 128 [fio]
8,16 10 3 0.008345976 11966 G R 73400600 + 128 [fio]
8,16 10 4 0.008346908 11966 P N [fio]
8,16 10 5 0.008348926 11966 I R 73400600 + 128 [fio]
8,16 10 6 0.008349651 11966 U N [fio] 1
8,16 10 7 0.008350694 11966 D R 73400600 + 128 [fio]
8,16 8 1 0.008771249 0 C R 73400600 + 128 [0]
While there are program version differences between the setups (in CentOS 7 blktrace is version 1.0.5 and the kernel is based off 3.10 whereas in Ubuntu 16.04 blktrace is version 1.1.0 and the kernel may be between 4.4 - 4.10) the real point may be down to what was asked (but unfortunately went unanswered) in one of the comments:
what [I/O] scheduler was in use
If we look at one of your m lines:
8,0 3 0 0.000015209 0 m N cfq24714SN /user.slice insert_request
we can see that it is a textual message (hence the m) and that it likely came from the CFQ I/O scheduler (hence the cfq prefix on the message itself). If the I/O scheduler being used for the /dev/sdb device on the CentOS 7 setup was not CFQ (e.g. because the noop I/O scheduler was being used) then we cannot expect similar messages to be present.
So bringing this back to the title of the question:
blkparse how to show IO Scheduler message
If an I/O scheduler wants to it can send free form blktrace text (e.g. see block/cfq-iosched.c which has calls to blk_add_trace_msg() in it) but not all I/O schedulers do (e.g. see block/noop-iosched.c which doesn't even include the linux/blktrace_api.h header). By default blkparse will show all messages present unless you use the -M option to suppress them.

Changing to a horizontal stack display with GNU dc?

GNU DC displays the stack vertically, (f displays the stack)
1 2 3 4
f # to display the stack
4
3
2
1
Is there a way to change this to be more like FORTH? While GNU FORTH displays the stack horizontally, (.s displays the stack)
1 2 3 4 ok
.s <4> 1 2 3 4 ok
You can create custom function in ~/.dcrc which is read each time dc start.
cat ~/.dcrc
[
# if the stack is empty
[ 2 + [stack empty] p 0 :- Q ]s-
z d 0 =- 0 :-
# keep the stack in indexed array -
[ z :- z 0 <- ]s-
l-x
# restore the stack
[ 0 ;- 1 + d ;- ;- r d ;- 1 + r :- 0 ;- d 1 + ;- r !<- ]s-
1 0 ;- 1 + :-
l-x
# displays the stack horizontally
[ 0 ;- d 1 + d ;- ;- n [ ] n d d ;- 1 + r :- ;- !>- ]s-
1 0 ;- 1 + :- l-x [ ok] p 0 :-
]s-
You call it this way :
echo '7 16 8 9' | dc -f - -e 'l-x f'
and you get :
7 16 8 9 ok
9
8
16
7
You cannot use register -

how to find similar users based on items purchsed

I have users and products which the user has purchased, and there seems to be no ratings for the products given by users. Blow is the sample data
DATA :
user products
A 111, 333, 444
B 333, 444, 555
C 555, 111, 333
D 222,333, 333,333
E 111,333,444,555
F 222,555,111
Can we find similar customers based on above data. Am trying to use 1 for product purchase and 0 if not like below.
111 222 333 444 555
A 1 0 1 1 0
B 0 0 1 1 1
C 1 0 1 0 1
D 0 1 1 0 0
E 1 0 1 1 1
F 1 1 0 0 1
Using the above matrix, how do I find similar customers. expecting an output in the below format.
user Id similar customers
A E, B, C
B E, A, F
C A, E
E A, B, C
F B, D
from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer
from sklearn.metrics.pairwise import cosine_similarity
df = df.set_index('user')
cvect = CountVectorizer()
cs = pd.DataFrame(cosine_similarity(cvect.fit_transform(df['products'])),
columns=df.index, index=df.index)
np.fill_diagonal(cs.values, 0)
threshold = 0.66
df['similar'] = cs[cs > threshold].apply(lambda row: row.dropna().index.tolist(), axis=1)
Result:
In [300]: df
Out[300]:
products similar
user
A 111, 333, 444 [B, C, E]
B 333, 444, 555 [A, C, E]
C 555, 111, 333 [A, B, E, F]
D 222,333, 333,333 []
E 111,333,444,555 [A, B, C]
F 222,555,111 [C]

How to construct an APNS notification in RPGLE?

Good Afternoon,
I am attempting to create a socket program which connects to Apple Push Notification Service (APNS) and sends a push notification.
I am wondering if anyone can help me with the actual writing of the APNS notification.
Below you can see my program which I used Scott Klement's Socket Programming tutorial to help me with.
The code that is probably relevant to all of this is marked as 'APNS Notification Format Begin', 'Initialize', and 'Formulate message to APNS' in comments although I included the entire program for reference.
I have read the Provider Requirements on Apple's site Provider Requirements but I am still having trouble getting everything working.
My program compiles and when I debug it / run through the steps I get past establishing an actual connection so I 'think' that this part is OK.
What I am hoping is to get back an error identifier from Apple in the variable errid within the item3 data structure. Apple states in the Provider Requirements that they return a status code if there is an error but that particular variable remains at 1077952576
There are also quite a few other things that I am unsure of
1) I have been given the device token as a Base64 string. The string is 40 some odd characters long but from what I understand, Apple states device token length should be 32 bytes. In RPGLE doesn't 1 character represent 1 byte? If that's the case then I couldn't just declare my variable token as
D token 32a
because it would get cut off?
2) Is anyone able to tell me what I am doing wrong when it comes back to receiving a proper error identifier from Apple in my variable errid?
Any help would be greatly appreciated
H DFTACTGRP(*NO) BNDDIR('QC2LE')
D/copy socket_h
D/copy gskssl_h
*==============================================================*
* APNS Notification Format Begin
*==============================================================*
D request s 1000a varying
D framehdr ds
D command 3I 0 inz(2)
D framelen 10I 0
D framedta s 500a varying
D item1 ds
D itemid1 3I 0 inz(1)
D itemlen1 5I 0 inz(%size(token))
D token 64a
D item2 ds
D itemid2 3I 0 inz(2)
D itemlen2 5I 0
D payload 100a varying
D item3 ds
D itemid3 3I 0 inz(3)
D itemlen3 5I 0 inz(%size(errid))
D errid 10I 0
D item4 ds
D itemid4 3I 0 inz(4)
D itemlen4 5I 0 inz(%size(expire))
D expire 10I 0 inz(0)
D item5 ds
D itemid5 3I 0 inz(5)
D itemlen5 5I 0 inz(%size(priority))
D priority 10I 0 inz(10)
*==============================================================*
* APNS Notification Format End
*==============================================================*
D gsk_strerror PR * extproc('gsk_strerror')
D gsk_ret_value 10I 0 value
D CreateEnv PR like(gsk_handle)
D ConnSock PR 10I 0
d host 256A const
D port 10I 0 value
D UpgradeSock PR like(gsk_handle)
D SslEnv like(gsk_handle) value
D sock 10I 0 value
D CloseSsl PR
D Handle like(gsk_handle) value
D CloseSslEnv PR
D SslEnv like(gsk_handle) value
D ReportError PR
D EscapeMsg PR
D errMsg s 80A varying
D CRLF c x'0d25'
D env s like(gsk_handle)
D s s 10I 0
D connto ds likeds(sockaddr_in)
D SslSock s like(gsk_handle)
D cmd s 400A
D len s 10I 0
D bytesSent s 10I 0
D Reply s 1000A
D bytesRead s 10I 0
D left s 10I 0
D buf s *
D received s 10I 0
D dataPos s 10I 0
D wait s 1A
D rc s 10I 0
/free
// Initialize
token = 'MyDevToken';
payload = '{"aps":{"alert":"You have mail"}}';
itemlen1 = %len(payload);
framedta = item1 + item2 + item3 + item4 + item5;
framelen = %len(framedta);
request = framehdr + framedta;
// Create SSL Environment
env = CreateEnv();
If (env = *NULL);
EscapeMsg();
Endif;
// Connect a socket to an SSL server (using normal socket calls)
// NOTE: Sandbox is the development environment
s = ConnSock('gateway.sandbox.push.apple.com': 2195);
// Upgrade the socket to SSL
SSLSock = UpgradeSock(env: s);
If (SSLSock = *NULL);
EscapeMsg();
Endif;
// **** Formulate message to APNS ******
len = %len(%trimr(request));
callp gsk_secure_soc_write(SSLSock
: %addr(request)
: len
: bytesSent);
// Close everything and end the program
CloseSsl(SslSock);
CloseSslEnv(Env);
*inlr = *on;
/end-free
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* CreateEnv(): Create an SSL environment for client sockets
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
P CreateEnv B
D CreateEnv PI like(gsk_handle)
D rc s 10I 0
D SslEnv s like(Gsk_handle)
/free
// Create an SSL environment with default values:
rc = gsk_environment_open(SslEnv);
If (rc <> GSK_OK);
errMsg = %str(gsk_strerror(rc));
return *NULL;
Endif;
// Instruct environment to use the *SYSTEM certificate store
rc = gsk_attribute_set_buffer( SslEnv
: GSK_OS400_APPLICATION_ID
: 'SUMITOMO_APNS_PUSH'
:0 );
If (rc<>GSK_OK);
errMsg = %str(gsk_strerror(rc));
gsk_environment_close( SslEnv );
return *NULL;
Endif;
//Tell the environment that this is a client connection
rc = gsk_attribute_set_enum( SslEnv
: GSK_SESSION_TYPE
: GSK_CLIENT_SESSION );
If (rc <> GSK_OK);
errMsg = %str(gsk_strerror(rc));
gsk_environment_close( SslEnv );
return *NULL;
Endif;
// Activate the new environment
rc = gsk_environment_init( SslEnv );
If (rc <> GSK_OK);
errMsg = %str(gsk_strerror(rc));
gsk_environment_close( SslEnv );
return *NULL;
Endif;
return SslEnv;
/end-free
P E
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* ConnSock(): Create a TCP Socket and connect to a host
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
P ConnSock B
D ConnSock PI 10I 0
d host 256A const
D port 10I 0 value
D s s 10I 0
D addr s 10U 0
/free
// look up host
addr = inet_addr(%trim(host));
If (addr = INADDR_NONE);
p_hostent = gethostbyname(%trim(host));
If (p_hostent = *NULL);
errMsg = 'Host not found!';
EscapeMsg();
Endif;
addr = h_addr;
Endif;
// Create a socket
s = socket(AF_INET: SOCK_STREAM: IPPROTO_IP);
If (s < 0);
ReportError();
Endif;
// connect to the host
connto = *ALLx'00';
connto.sin_family = AF_INET;
connto.sin_addr = addr;
connto.sin_port = port;
If (connect(s: %addr(Connto): %size(connto)) = -1);
callp close(S);
ReportError();
Endif;
return s;
/end-free
P E
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* UpgradeSock(): Upgrade a socket to use SSL
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
P UpgradeSock B
D UpgradeSock PI like(gsk_handle)
D SslEnv like(gsk_handle) value
D sock 10I 0 value
D Handle s like(Gsk_handle)
/free
rc = gsk_secure_soc_open(SslEnv: Handle);
If (rc <> GSK_OK);
errMsg = %str(gsk_strerror(rc));
return *NULL;
Endif;
rc = gsk_attribute_set_numeric_value(Handle
: GSK_HANDSHAKE_TIMEOUT
: 30 );
If (rc <> GSK_OK);
errMsg = %str(gsk_strerror(rc));
gsk_secure_soc_close(Handle);
return *NULL;
Endif;
rc = gsk_secure_soc_init( Handle );
If (rc <> GSK_OK);
errMsg = %str(gsk_strerror(rc));
gsk_secure_soc_close(Handle);
return *NULL;
Endif;
return Handle;
/end-free
P E
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* CloseSsl(): Close an SSL socket
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
P CloseSsl B
D CloseSsl PI
D Handle like(gsk_handle) value
/free
gsk_secure_Soc_close( handle);
/end-free
P E
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* CloseSslEnv(): Close SSL Environment
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
P CloseSslEnv B
D CloseSslEnv PI
D SslEnv like(gsk_handle) value
/free
gsk_environment_close( SslEnv );
/end-free
P E
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* EscapeMsg(): Send an escape message w/reason for SSL failure
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
P EscapeMsg B
D EscapeMsg PI
D SndPgmMsg PR ExtPgm('QMHSNDPM')
D MessageID 7A Const
D QualMsgF 20A Const
D MsgData 256A Const
D MsgDtaLen 10I 0 Const
D MsgType 10A Const
D CallStkEnt 10A Const
D CallStkCnt 10I 0 Const
D MessageKey 4A
D ErrorCode 1A
D ErrorCode DS
D BytesProv 10I 0 inz(0)
D BytesAvail 10I 0 inz(0)
D wwTheKey S 4A
/free
SndPgmMsg( 'CPF9897'
: 'QCPFMSG *LIBL'
: errMsg
: %len(%trimr(errMsg))
: '*ESCAPE'
: '*CTLBDY'
: 1
: wwTheKey
: ErrorCode );
/end-free
P E
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* ReportError(): Send an escape message explaining any errors
* that occurred.
*
* This function requires binding directory QC2LE in order
* to access the __errno() function.
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
P ReportError B
D ReportError PI
D get_errno PR * ExtProc('__errno')
D ptrToErrno s *
D errno s 10I 0 based(ptrToErrno)
D QMHSNDPM PR ExtPgm('QMHSNDPM')
D MessageID 7A Const
D QualMsgF 20A Const
D MsgData 1A Const
D MsgDtaLen 10I 0 Const
D MsgType 10A Const
D CallStkEnt 10A Const
D CallStkCnt 10I 0 Const
D MessageKey 4A
D ErrorCode 8192A options(*varsize)
D ErrorCode DS qualified
D BytesProv 1 4I 0 inz(0)
D BytesAvail 5 8I 0 inz(0)
D MsgKey S 4A
D MsgID s 7A
/free
ptrToErrno = get_errno();
MsgID = 'CPE' + %char(errno);
QMHSNDPM( MsgID
: 'QCPFMSG *LIBL'
: ' '
: 0
: '*ESCAPE'
: '*PGMBDY'
: 1
: MsgKey
: ErrorCode );
/end-free
P E
This isn't even close, you're using characters instead of binary data.
cmd = '2' + 3 + 1 + 64 + 'x' + 2 + 50 + '{"aps":{"alert":"You have mail"}} +
3 + 3 + '001'
This should be closer; but it is off the top of my head and completely untested...
d request s 1000a varying
d frame_hdr ds
d cmd 1a inz(x'02')
d frame_len 10i 0
d frame_data s 500a varying
d device_item ds
d 1a inz(x'01')
d 5i 0 inz(%size(device_item))
d token 32a
d item_hdr ds
d id 1a inz(x'02')
d item_len 5i 0
d item_data s 100a varying
item_data = '{"aps":{"alert":"You have mail"}}';
item_len = %len(item_data);
token = myDevID;
frame_data = device_item + item_hdr + item_data;
frame_len = %len(frame_data);
request = frame_hdr + frame_data;
callp gsk_secure_soc_write(SSLSock
: %addr(request:*DATA)
: %len(request)
: bytesSent);
I've not done raw sockets on the IBM i before, you may have to convert EBCDIC to ASCII. I don't think you'll need to worry about little vs. big endian.
RPG is probably not the best choice for this, Java might be a better choice given the existence of projects like Java PNS
Stackoverflow doesn't have a whole lot of RPG / IBM i traffic. You may get a better response on the following:
http://lists.midrange.com/mailman/listinfo/rpg400-l
http://lists.midrange.com/mailman/listinfo/web400
http://www.scottklement.com/mailman/listinfo/ftpapi

Resources