mirror of
https://github.com/eclipse/upm.git
synced 2025-03-24 01:10:22 +03:00
mic: throw exception(s) on fatal errors
Signed-off-by: Jon Trulson <jtrulson@ics.com> Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
This commit is contained in:
parent
14fc909400
commit
b8ee0cf22d
@ -23,6 +23,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <string>
|
||||||
|
#include <stdexcept>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
@ -33,9 +35,13 @@ using namespace upm;
|
|||||||
|
|
||||||
Microphone::Microphone(int micPin) {
|
Microphone::Microphone(int micPin) {
|
||||||
// initialise analog mic input
|
// initialise analog mic input
|
||||||
m_micCtx = mraa_aio_init(micPin);
|
|
||||||
|
if ( !(m_micCtx = mraa_aio_init(micPin)) )
|
||||||
|
{
|
||||||
|
throw std::invalid_argument(std::string(__FUNCTION__) +
|
||||||
|
": mraa_aio_init() failed, invalid pin?");
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Microphone::~Microphone() {
|
Microphone::~Microphone() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user