edu.udayton.udri.asset.raspi.pir/src/edu/udayton/udri/asset/raspi/pir/RasPIRAsset.java
private Observation onMotionDetection() throws AssetException
    {
        try (CountingWakeLockHandle wakeHandle = m_CountingLock.activateWithHandle())
        {
            final Date date = new Date();
            Logging.log(LogService.LOG_INFO, "Motion Detected " + date);
    
            final SensingModality sensmod = new SensingModality(SensingModalityEnum.PIR, "PIR");
    
            final Detection detect = new Detection();
            detect.setType(DetectionTypeEnum.ALARM);
            
            final Observation obs = new Observation().withModalities(sensmod).withDetection(detect);
            try 
            {
                m_Context.persistObservation(obs);
            } 
            catch (final PersistenceFailedException | ValidationFailedException e) 
            {
                Logging.log(LogService.LOG_ERROR, e.toString());
                Logging.log(LogService.LOG_ERROR, "Observation persistance failed");
            }
            return obs;
        }
    }
/**
     * Method that creates and returns an observation with the sensing modality and detection type
     * when motion has been detected.
     * 
     * @return 
     *      persisted observation with sensing modality and detection type
     * @throws AssetException 
     *      thrown if creation of observation fails
     */
Method that creates and returns an observation with the sensing modality and detection type
when motion has been detected.

@return
persisted observation with sensing modality and detection type
@throws AssetException
thrown if creation of observation fails
Method that creates and returns an observation with the sensing modality and detection type when motion has been detected . @return persisted observation with sensing modality and detection type @throws AssetException thrown if creation of observation fails
private Observation onMotionDetection() throws AssetException
    {
        try (CountingWakeLockHandle wakeHandle = m_CountingLock.activateWithHandle())
        {
            final Date date = new Date();
            Logging.log(LogService.LOG_INFO, "Motion Detected " + date);
            final SensingModality sensmod = new SensingModality(SensingModalityEnum.PIR, "PIR");
            final Detection detect = new Detection();
            detect.setType(DetectionTypeEnum.ALARM);
            final Observation obs = new Observation().withModalities(sensmod).withDetection(detect);
            try 
            {
                m_Context.persistObservation(obs);
            } 
            catch (final PersistenceFailedException | ValidationFailedException e) 
            {
                Logging.log(LogService.LOG_ERROR, e.toString());
                Logging.log(LogService.LOG_ERROR, "Observation persistance failed");
            }
            return obs;
        }
    }
private Observation onMotionDetection ( ) throws AssetException { try ( CountingWakeLockHandle wakeHandle = m_CountingLock . activateWithHandle ( ) ) { final Date date = new Date ( ) ; Logging . log ( LogService . LOG_INFO , "Motion Detected " + date ) ; final SensingModality sensmod = new SensingModality ( SensingModalityEnum . PIR , "PIR" ) ; final Detection detect = new Detection ( ) ; detect . setType ( DetectionTypeEnum . ALARM ) ; final Observation obs = new Observation ( ) . withModalities ( sensmod ) . withDetection ( detect ) ; try { m_Context . persistObservation ( obs ) ; } catch ( final PersistenceFailedException | ValidationFailedException e ) { Logging . log ( LogService . LOG_ERROR , e . toString ( ) ) ; Logging . log ( LogService . LOG_ERROR , "Observation persistance failed" ) ; } return obs ; } }
Method that creates and returns an observation with the sensing modality and detection type
 when motion has been detected.
Method that creates and returns an observation with the sensing modality and detection type when motion has been detected .