aboutsummaryrefslogtreecommitdiffstats
path: root/binding/radio-binding.c
AgeCommit message (Collapse)AuthorFilesLines
2023-01-19Repurpose into gRPC serviceScott Murray1-752/+0
Repurpose repository into a spiritual successor of the previous binding. The backend code is retained behind a new gRPC API defined in protos/radio.proto. The simpler synchronous gRPC API had been used for expediency, this may warrant revisiting to rework into an async or callback API based server instead. As well, authentication has been left until some consensus on an approach can be worked out. Bug-AGL: SPEC-4665 Signed-off-by: Scott Murray <scott.murray@konsulko.com> Change-Id: I28b122ce6e0ecfc7504aa08b90394cb1b9e22976 (cherry picked from commit dd23c157bdba1b25bbb50cdb99a60aa597735f43)
2020-12-06Rework hardware probing and RTL-SDR helper startupScott Murray1-14/+19
The lazy startup of the separate helper program for the RTL-SDR backend on playback start was incorrect with respect to the expected behavior the frequency setting verbs. This was not visible during usage by the radio application, but was triggering failures in several tests in the pyagl binding wrapper test suite. To facilitate starting the helper during backend initialization, the probing part of the backend "init" has been split into a separate "probe" function, and all backends have been updated to reflect this change. Logic has been added to enforce that "init" is only called after "probe" has succeeded for a backend, and a comment has been added to radio_impl.h to document this intended behavior. Bug-AGL: SPEC-3717 Signed-off-by: Scott Murray <scott.murray@konsulko.com> Change-Id: Ic37331a92bae7cc01ee448e69894fa5f49d08a74
2020-10-28Add support for tuning to alternative frequencyEhsan Takalloo1-0/+93
-Add a new verb for handling alternative frequency. -Add a new structure (station_quality_t) and use it for sharing quality parameters. -Make tef665x implementations compatible with new structure. -Update README.md file to cover new verbs. Change-Id: Id78e3b9aa8896eca9ef44222657f21246de9914f Signed-off-by: Ehsan Takalloo <ehsan.takalloo@gmail.com>
2020-10-06Fix frequency verb invalid frequency behaviorScott Murray1-6/+22
The frequency verb was not checking if a frequency corresponds to the frequency band step the binding provides to users, add logic to do so and return an error if the frequency is invalid. While this is a change in behavior, it is believe it should not impact users, as the binding is intended to reflect user facing radio application usage. Additional tweaks: - fix error invalid frequency error message in reply JSON. - add the same band limit checks to the null implementation's frequency setting function that the other implementations do. - fix a couple of issues in README.md; the "rds" verb was missing, and the value key name for the "frequency" event was incorrect. Bug-AGL: SPEC-3620 Signed-off-by: Scott Murray <scott.murray@konsulko.com> Change-Id: I2adfc10448546264110f6d854f02d677087f1e47
2020-09-08Add null backendjellyfish_9.99.4jellyfish/9.99.49.99.4Scott Murray1-2/+6
Changes: - Add null radio implementation that acts as the fallthrough default when the hardware implementations are not detected. - Tweaked the probing in the tef665x implementation to not return an error if the I2C node is not even present. This cleans up the logs on start up on most platforms. These changes include some minor whitespace consistency clean ups. - Added the run-by-default widget permission now that the binding should always work. This will ease testing, and potentially decrease app start up time. Bug-AGL: SPEC-3570 Signed-off-by: Scott Murray <scott.murray@konsulko.com> Change-Id: I3c2e60ce7272d248ab87e3b79d6a334e17fe5531
2020-09-01Add rds eventEhsan Takalloo1-2/+22
Update types in radio_impl_tef665x.c and radio_impl_tef665x.h Add rds verb to tef665x and send latest rds as response Implement rds parser based on rds standard structure and tef-665x user-manual for rds group types 0A, 0B, 1A, 2A, 2B and 4A Implement scan_start verb for tef-665x Implement scan_stop verb for tef-665x Implement get stereo_mode verb for tef-665x Fix an issue in tef665x_set_frequency_callback Update README.md file Signed-off-by: Ehsan Takalloo <ehsan.takalloo@gmail.com> Change-Id: Ife057e46c52fc420541dbad3b4f51c7d01707a3d
2019-12-31Add support for TEF665x in agl-service-radioicefish_8.99.5icefish/8.99.58.99.5VahidGharaee1-0/+5
This is a NXP tuner AM/FM/RDS. The chip has analogue and digital sound output and input. Chip is controlled through i2c. I had to add a sound cart to the kernel to be able to capture the i2s data from the chip. Some of the verbs still to be implemented. I test it on a costum board with imx6solo. Bug-AGL SPEC-3071 Signed-off-by: VahidGharaee <vgharaee@gmail.com> Change-Id: I868706e6d275aef77f77138f815b1b53d64780be
2019-12-19Fixes for corking and restart behavioricefish_8.99.4icefish/8.99.48.99.4Scott Murray1-2/+8
Fixes: - Track playing state in binding code to properly ignore signal-composer events when not playing. - Add changing of pipeline state in response to the GstBus GST_MESSAGE_REQUEST_STATE message to the KF code, this is required to have the second request to switch back to PLAYING state be sent, and hence properly keeping track of corked state. Also added required gstreamer main loop so GstBus actually works. - The alsasrc used in the KF code's gstreamer pipeline seems to not handle the switch to READY state on pause (currently required to trigger Wireplumber policy) as expected; it seems to keep feeding the pipeline, causing long stalls on restart. For now, taking the stream fully down to NULL state seems to work around this issue. Bug-AGL: SPEC-3061, SPEC-3046 Change-Id: I31b2759d10087efbe4ccd885600be95b7029c598 Signed-off-by: Scott Murray <scott.murray@konsulko.com>
2019-12-14radio: check for corking from PipeWireicefish_8.99.3icefish/8.99.38.99.3Matt Ranostay1-0/+4
Check if PipeWire is corking the audio stream and if so don't process signal-composer events till uncorked Bug-AGL: SPEC-3023 Change-Id: I1a4623022bbe28658bc97b5fe0cda58863f20d8c Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
2019-12-14Initial steering wheel event supportScott Murray1-3/+64
Add initial basic support for next/previous events from signal composer, mapping them to seek forward/back. More work will be required to handle the issues around both mediaplayer and radio both being running and differentiating which should handle the events. Additionally, complete transition to binding version 3 to clean things up. Bug-AGL: SPEC-3046 Change-Id: I251fa461c96dba584a3fe0069bab4fd2e54701ad Signed-off-by: Scott Murray <scott.murray@konsulko.com>
2019-12-02Migration to binding V3icefish_8.99.2icefish/8.99.28.99.2Li Xiaoming1-56/+56
Bug-AGL: SPEC-2745 Change-Id: I5ee9d3118a302f0edf5fe79a43590818d3d829c3 Signed-off-by: Li Xiaoming <lixm.fnst@cn.fujitsu.com>
2019-06-10Remove support for 4A and pulseaudio completelyGeorge Kiagiadakis1-73/+2
Bug-AGL: SPEC-2473 Signed-off-by: George Kiagiadakis <george.kiagiadakis@collabora.com> Change-Id: I320be57ce48a63c7e85b8daebf7b094423f580f9
2019-06-04binding: make 4A truly optionalGeorge Kiagiadakis1-0/+4
The non-4A codepaths were totally broken here Bug-AGL: SPEC-2473 Change-Id: I1c3c49688566684455bf9522f68f506eaf6aa6c3 Signed-off-by: George Kiagiadakis <george.kiagiadakis@collabora.com>
2019-01-06Add status eventhalibut_7.90.0halibut/7.90.0guppy_6.99.4guppy/6.99.47.90.06.99.4Scott Murray1-0/+16
Add a status event to indicate playing versus stopped state, this allows users to detect when the binding has been stopped by another user. Change-Id: I4c1256427f0113b535e12a2dbc121d45c93dc0dd Signed-off-by: Scott Murray <scott.murray@konsulko.com> (cherry picked from commit a2fdf6e139207e7b0e0270c8a167c6a30c8fe61d)
2019-01-04Add audio role open/close supportScott Murray1-69/+78
Rework things so that the 4A audio role is only opened while playing, and closed when stopped. Further work will need to be done to handle the possibility of the output device changing on subsequent opens, both the RTL SDR and Kingfisher case have complications around doing so: - The RTL SDR helper application needs to be enhanced to add an output setting command. Killing it and starting it again would also work, but likely will add noticeable UI latency. - On the Kingfisher, the binding currently has no control over the output used for the loopback, as it is being set up down in the soft-mixer based on HAL values. Change-Id: I4aa83c937972ec5d91f7b78421a11148c7fe0afc Signed-off-by: Scott Murray <scott.murray@konsulko.com> (cherry picked from commit f1d5902c92eafd3aad62e29298502603a9b56d81)
2018-07-17fixed the support for 4a frameworkThierry Bultel1-31/+61
Changed the api call for getting an audio role. Mapped the stop/start operations to mute/unmute actions on role verb. No longer uses a gstreamer pipeline for the sound output, since it is 4a-softmixer that performs the read/write loop instead. Change-Id: I91e4f801a0da866c50b2218622e810d7350ab8a9 Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
2018-07-17added api verb for RDS informationThierry Bultel1-2/+30
Added a verb to retrieve the RDS information. Notice that it is only supported on the kingfisher implementation. Change-Id: I0e2a830ff77154eb8cbb780bb599fb49f71a5b1c Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
2018-07-17Set the binding version in cmake instead of sourceThierry Bultel1-2/+0
Setting AFB_BINDING_VERSION is cmake makes merges easier between branches, since it is always defined once at a single place instead that in each file that need it. Also removed the "INSTALL" section with LIBRARY_DESTINATION since it is now treated in app-templates. Change-Id: I7ef5f3b4d2009ab6ec296ac70bfc0a5647f9534c Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
2018-07-17Fixed compilation warningsThierry Bultel1-1/+1
Fixed all the compilation warning that appeared with the latest version of gcc. There are still warnings in the gstreamer headers, that would likely be fixed by a gstreamer bump. Change-Id: I3ae7698dbff47303be366d9755a643a013bb4e51 Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
2018-06-05Rework output to directly support 4Aflounder_5.99.1flounder/5.99.15.99.1Scott Murray1-2/+33
When building for 4A, switch to new gstreamer-based ALSA output for the RTL-SDR backend, and the Kingfisher backend now uses a gstreamer pipeline for its loopback to either an ALSA or Pulse sink depending on 4A or not. Using gstreamer instead of direct ALSA output has the benefit of transparently handling resampling to the M3ULCB hardware's required 48 KHz sample rate for the RTL-SDR backend. Change-Id: I2bfbf924927bb461cce88b04aba0e626f8d71215 Signed-off-by: Scott Murray <scott.murray@konsulko.com>
2018-06-05Always enable Kingfisher supportScott Murray1-4/+0
Make Kingfisher support unconditional to move all platform detection to run-time. This fixes the issue of violating the application build workflow with the SDK. Additionally, the Kingfisher detection has been improved with an added check for the Si4689 device-tree node to differentiate from a regular M3ULCB, and the Kingfisher output has been fixed for recent BSP changes. Change-Id: I28e18a065385205aefec974079b0a9c2d31059b6 Signed-off-by: Scott Murray <scott.murray@konsulko.com>
2018-05-15Remove reference to <afb/afb-service-itf.h>José Bollo1-1/+0
Change-Id: Ic5130850f76db94d86fb94e904ac5f985cf0aa30 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-03-20Add Kingfisher Si4689 supportHarunobu Kurokawa1-17/+32
Add conditionally compilable support for the Si4689 radio on the M3ULCB Kingfisher infotainment board. The codebase has been refactored to allow multiple radio implementations, and when Kingfisher support is enabled, the binding will first look for a USB RTL-SDR adapter, then fallback to the Kingfisher Si4689 if one is not found. This allows easily switching to a RTL-SDR adapter if this initial Kingfisher support encounters issues. The back end implementation relies on a patched version of the "si_ctl" utility from Cogent Embedded's Kingfisher BSP changes. The modifications to it add FM band plan selection and scanning threshold tweaking for poor radio environments. Audio output is achieved by looping the radio's PulseAudio source to the appropriate sink depending on 4A or non-4A operation. For 4A compatibility, the PulseAudio source is created if it does not exist, which currently is the case due to PulseAudio's udev module being disabled when 4A is enabled. Additionally, the FM band plan for Japan has been corrected to go to 95 MHz, and a README.md file has been added documenting the optional configuration that can be done via /etc/xdg/AGL.conf for band plan selection and scanning sensitivity. Change-Id: I204906fed741d917fc3b8be962deadb4e59989db Signed-off-by: Scott Murray <scott.murray@konsulko.com> Signed-off-by: Harunobu Kurokawa <harunobu.kurokawa.dn@renesas.com>
2017-11-24Return a correct value for 'start'José Bollo1-2/+1
The returned value was presumed to be garbage. Change-Id: I72997d267139cc89f5dd5d325fc0512f44859b90 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-11Switch to AFB_SESSION_NONE for verbsScott Murray1-12/+12
Recent testing found that the verbs no longer work now with the AFB_SESSION_CHECK flag set on them and the binding split out to be standalone from the app. Since the radio does not really need the concept of a session, switch to AFB_SESSION_NONE to get things working, rather than add the extra infrastructure to enable session support. Change-Id: I9c022eaf7a18a1094b9afb7c6bddf1a8ebc9e875 Signed-off-by: Scott Murray <scott.murray@konsulko.com>
2017-08-17binding: radio: upgrade to v2 of binding frameworkMatt Ranostay1-35/+26
Update structures and function calls to afm binding framework version 2 specs Bug-AGL: SPEC-835 Change-Id: Ie9198c4fe035e2267a1098fac7995b60e65809ec Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
2017-08-17binding: radio: update build system for standalone bindingMatt Ranostay1-0/+493
Radio binding is now standalone so the qmake build scripts need to be updated to reflect that Bug-AGL: SPEC-832 Change-Id: Iab9cd5d18536e416d22d91c492ef489159a62d0d Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>