public final class AirSend extends SimpleIP
© Devmel SDK (java) ©
Constructor and Description |
---|
AirSend(SimpleIPLocator locator)
Constructs an AirSend object.
|
Modifier and Type | Method and Description |
---|---|
static byte[] |
buildConfigOOK(int radioFrequencyHz,
int dataRateHz,
boolean interrupt,
int xosc)
Builds and returns an ook configuration for cc1101
|
int |
getBlockingTimeout()
Returns the blocking read timeout
|
byte[] |
getConfiguration()
Get the CC1101 configuration
|
int |
getOscillator()
Get the cc1101 oscillator frequency (fxosc)
|
byte[] |
getPowerTable()
Get the CC1101 patable
|
boolean |
open()
Opens and initializes the device.
|
boolean |
read(Frame frame,
boolean hasNext)
Reads the data received into the cc1101
|
byte[] |
read(int maxSize,
boolean hasNext)
Reads the data received into the cc1101
|
int |
readIlluminance()
Reads the illuminance value in lux
|
double |
readTemperature()
Reads the temperature value in kelvins
|
void |
setBlockingTimeout(int timeout)
Sets the blocking read timeout
|
void |
setConfiguration(byte[] configuration)
Sets the CC1101 configuration.
|
void |
setPowerTable(byte[] patable)
Sets the CC1101 power table.
|
int |
write(byte[] data,
boolean hasNext)
Writes the specified byte array into the cc1101 and transmit it
|
boolean |
write(Frame frame)
Writes the specified radio frame into the cc1101 and transmit it
|
close, finalize, getDataSizeLimit, getExceptions, getLastException, getLock, getTimeout, getVersion, isLocalConnected, isOpen, setExceptions, setLock, setTimeout
public AirSend(SimpleIPLocator locator)
locator
- a resource locator of AirSend devicepublic static byte[] buildConfigOOK(int radioFrequencyHz, int dataRateHz, boolean interrupt, int xosc)
radioFrequencyHz
- the radio frequency in hertz (ex : 433920000)dataRateHz
- the data rate in baudinterrupt
- true to set as interrupt read, false otherwisexosc
- the cc1101 oscillator frequency in hertzpublic int getBlockingTimeout()
public byte[] getConfiguration()
public int getOscillator()
public byte[] getPowerTable()
public boolean open() throws SimpleIPException
SimpleIP.close()
is eventually called.SimpleIPException
- on error opening the port.public boolean read(Frame frame, boolean hasNext) throws SimpleIPException
frame
- the frame into which the data is updatedhasNext
- false to set cc1101 as idle after reception, true otherwiseSimpleIPException
- if an I/O exception occurs and exceptions are not disabledpublic byte[] read(int maxSize, boolean hasNext) throws SimpleIPException
maxSize
- the maximum size to readhasNext
- false to set cc1101 as idle after reception, true otherwiseSimpleIPException
- if an I/O exception occurs and exceptions are not disabledpublic int readIlluminance() throws SimpleIPException
SimpleIPException
- if an I/O exception occurs and exceptions are not disabledpublic double readTemperature() throws SimpleIPException
SimpleIPException
- if an I/O exception occurs and exceptions are not disabledpublic void setBlockingTimeout(int timeout)
timeout
- Milliseconds timeout, <0 no blockingpublic void setConfiguration(byte[] configuration)
configuration
- the cc1101 configurationpublic void setPowerTable(byte[] patable)
patable
- the cc1101 patablepublic int write(byte[] data, boolean hasNext) throws SimpleIPException
data
- the datahasNext
- false to set cc1101 as idle after transmit, true otherwiseSimpleIPException
- if an I/O exception occurs and exceptions are not disabledpublic boolean write(Frame frame) throws SimpleIPException
frame
- the frameSimpleIPException
- if an I/O exception occurs and exceptions are not disabled