public class Meet extends java.lang.Object implements NoiseListener, FileListener, Orientation.SensorCallBack, Netandgps.PositionSensorCallBack
Modifier and Type | Field and Description |
---|---|
ContextData |
ctxData
context data
|
java.util.List<FileManager> |
files4noise
sounds recorded by the devices we are meeting with
|
boolean |
isSynchronised
determine if the device is synchronised
|
boolean |
isTimeServer
determine if the device is the time server
|
Record |
measurement
sound measurements
|
java.util.List<ProtocolState> |
meetwithProtocolState
state of the protocol concerning the device we are meeting with
|
java.util.List<Device> |
meetwithS
list of devices we are meeting with
|
java.util.ArrayList<java.lang.String> |
namesFiles4Noise
ArrayList created so as to save the name of calibrated devices
|
java.lang.String |
nRecordTest
file name
|
java.util.ArrayList<java.lang.String> |
orientation
orientation
|
java.util.ArrayList<java.lang.String> |
position
position
|
long |
roundTripDelay
round trip delay as provided by ntp
|
Constructor and Description |
---|
Meet(android.content.Context actx) |
Meet(Device device2meet,
android.content.Context actx,
boolean fileMode)
create a meeting (with the provided device)
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
add_uncalibrated_devices()
what to do with uncalibrated devices that are not usefull to calibrate the device
|
void |
add(Device device2meet,
android.content.Context actx,
boolean fileMode)
add a device to the group that meet
|
void |
addSleepListener(SleepListener toadd)
add a sleep time
|
java.lang.String |
calibrate()
calibrate
|
java.lang.String |
configureRegression()
configure the parameters that are necessary to run a regression (a.k.a calibration)
|
void |
end()
end of the meeting, release the resources
|
java.lang.String |
follow_to_robustly_calibrate()
robust calibration is performed during this meeting
|
java.lang.String |
follow_to_simply_calibrate()
perform a simple calibration (find the best simple calibration
|
java.lang.String |
getlocalFile4NoiseName()
returns the name fof the file wherein the sound recorded locally is stored
|
FileManager |
getLocalFileManager4Noise()
get the file where the (local) sound is stored
|
void |
getLocalSoundRecording()
start recording the sound
|
void |
getLocalSoundRecording2ConsecTests(int nTests)
is called before recording hte local sound,
we sleep for a little of time (to permit other devices to join the group
|
java.lang.String |
getName(int i)
get the name of a device
|
int |
getPosition(int device_id)
provide the position of the requested device in the list of devices meeting
* return -1 if the device is not found
|
int |
getPositionfromVertex(int vertex_id)
provide the position of the requested device in the list of devices meeting using the provided vertexid
|
java.lang.String |
getRemoteFile4NoiseName(Device device)
return the content of the file wherein the sound provided by
the other device, is stored
|
double |
getTimeOffset()
time offset with regards to the wifi direct ap
|
void |
init(android.content.Context actx)
initialise the meeting
|
java.lang.String |
old_calibrates()
calibration
|
void |
onSensorOrientationChanged(float axisX,
float axisY,
float axisZ,
long timestamp) |
void |
onSensorPositionChanged(double latitude,
double longitude,
long localGPStime) |
void |
regress_all()
apply a regression
|
void |
regress(java.util.List<FileManager> asoundfileList)
perform a regression using the measurements that are stored in the files list
|
void |
removeSleepListener(SleepListener toremove)
remove a sleep time
|
void |
resetLocalFileManager4Noise()
reset the stream of the file wherein sound will be saved
|
java.nio.DoubleBuffer |
savelocalrecord(java.nio.DoubleBuffer buffer,
double slot)
save the raw sound recorded locally and provided in the buffer in a file
considering the time slot between two recording
|
void |
saveRemoteRecord(java.lang.String buf,
Device who)
save the sound that is provided b y the given remote device
|
void |
scheduleMeetingin5sec()
schedule a meeting in 5 sec
|
void |
setTimeOffset(double time)
set the time offset
|
java.nio.DoubleBuffer |
shift(java.nio.DoubleBuffer buffer,
int shift,
double slope,
double intercept)
we remove a number of samples.
|
void |
sleepFor(long millisec)
sleep during the amount of millisecs that is provided
|
void |
sleepingThread(long millisec)
start a sleep thread
|
void |
someoneReportedFileChange(int type)
the informations have been written in the file
|
void |
someoneReportedNoiseChange(int type)
Noise change
|
void |
someoneReportedNoiseError()
is used to determine whether there is an error
|
public java.lang.String nRecordTest
public long roundTripDelay
public boolean isSynchronised
public ContextData ctxData
public Record measurement
public java.util.ArrayList<java.lang.String> orientation
public java.util.ArrayList<java.lang.String> position
public boolean isTimeServer
public java.util.ArrayList<java.lang.String> namesFiles4Noise
public java.util.List<Device> meetwithS
public java.util.List<ProtocolState> meetwithProtocolState
public java.util.List<FileManager> files4noise
public Meet(android.content.Context actx)
actx
- contextpublic Meet(Device device2meet, android.content.Context actx, boolean fileMode)
device2meet
- device we are meeting withactx
- contextfileMode
- file modepublic double getTimeOffset()
public void setTimeOffset(double time)
time
- time offsetpublic void resetLocalFileManager4Noise()
public FileManager getLocalFileManager4Noise()
public int getPositionfromVertex(int vertex_id)
vertex_id
- vertex idpublic int getPosition(int device_id)
device_id
- device idpublic java.lang.String getlocalFile4NoiseName()
public java.lang.String getRemoteFile4NoiseName(Device device)
device
- device idpublic void init(android.content.Context actx)
actx
- contextpublic void end()
public java.lang.String getName(int i)
i
- position of the device in the meeting grouppublic void add(Device device2meet, android.content.Context actx, boolean fileMode)
device2meet
- device we are meeting with and we should add to the groupactx
- contextfileMode
- file modepublic void onSensorOrientationChanged(float axisX, float axisY, float axisZ, long timestamp)
onSensorOrientationChanged
in interface Orientation.SensorCallBack
public void onSensorPositionChanged(double latitude, double longitude, long localGPStime)
onSensorPositionChanged
in interface Netandgps.PositionSensorCallBack
public void getLocalSoundRecording()
public void getLocalSoundRecording2ConsecTests(int nTests)
nTests
- number of tests that should be performed (i.e. , number of calibrations)public void saveRemoteRecord(java.lang.String buf, Device who)
buf
- buffer storing the soundwho
- device we are meeting with and that collected the soundpublic java.nio.DoubleBuffer shift(java.nio.DoubleBuffer buffer, int shift, double slope, double intercept)
buffer
- sound buffershift
- delay / nn of measurements to shiftslope
- slope used to weight the measurementsintercept
- intercept used to weight the measurementspublic java.nio.DoubleBuffer savelocalrecord(java.nio.DoubleBuffer buffer, double slot)
buffer
- soundbufferslot
- delay between two consecurive measurementspublic void addSleepListener(SleepListener toadd)
toadd
- sleep timer to addpublic void removeSleepListener(SleepListener toremove)
toremove
- sleep time to removepublic void sleepingThread(long millisec) throws java.lang.Exception
millisec
- duration of the sleepjava.lang.Exception
- could not run the threadpublic void sleepFor(long millisec)
millisec
- sleep durationpublic void scheduleMeetingin5sec()
public void someoneReportedNoiseChange(int type)
NoiseListener
someoneReportedNoiseChange
in interface NoiseListener
type
- type of changepublic void someoneReportedNoiseError()
someoneReportedNoiseError
in interface NoiseListener
public void someoneReportedFileChange(int type)
FileListener
someoneReportedFileChange
in interface FileListener
public java.lang.String configureRegression()
public java.lang.String add_uncalibrated_devices()
public java.lang.String follow_to_robustly_calibrate()
public java.lang.String follow_to_simply_calibrate()
public void regress(java.util.List<FileManager> asoundfileList)
asoundfileList
- list of files used to store hte measurements that will be used to regresspublic void regress_all()
public java.lang.String calibrate()
public java.lang.String old_calibrates()