|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IProtocol
v0.6.1 Magnum PI
This interface defines all the messages that can be sent to the Arduino and provides a method to analyze all messages from Arduino. For each message sent the caller can set a callback class. In this way the caller can know asynchronously if a message has been processed by Arduino board. If callback class is not setted (or is null) then arduino should not send a reply message because caller is not interested in replies.
ProtocolHandler
,
Link
,
Nested Class Summary | |
---|---|
static class |
IProtocol.ProtocolType
|
Field Summary | |
---|---|
static byte |
DEFAULT_INCOMING_MESSAGE_DIVIDER
|
static byte |
DEFAULT_OUTGOING_MESSAGE_DIVIDER
|
static int |
HIGH
|
static int |
LOW
|
static int |
POWER_HIGH
|
static int |
POWER_LOW
|
static int |
REPLY_KO
|
static int |
REPLY_OK
|
static int |
UNDEFINED_ID
|
static int |
UNDEFINED_REPLY
|
Method Summary | |
---|---|
int |
getIncomingMessageDivider()
the incoming message divider used from Connection to divide incoming message (if ProtocolType is binary then incoming must be equal to outgoing |
int |
getOutgoingMessageDivider()
the outgoing message divider used from Protocol to divide outgoing message (if ProtocolType is binary then incoming must be equal to outgoing |
String |
getProtocolName()
|
IProtocol.ProtocolType |
getProtocolType()
|
IncomingMessageEvent |
parseMessage(int[] realMsg)
When a message arrives from Arduino, ConnectionContactImpl and Link classes call this method that parses message and returns a specific event. |
MessageInfo |
sendCustomMessage(Link link,
String message)
Sends a custom message used for specific actions in Arduino sketches |
MessageInfo |
sendCustomMessage(Link link,
String message,
ReplyMessageCallback callback)
Sends a custom message used for specific actions in Arduino sketches |
MessageInfo |
sendKeyPressEvent(Link link,
char keychar,
int keycode,
int keylocation,
int keymodifiers,
int keymodifiersex)
Sends information about which key was pressed. |
MessageInfo |
sendKeyPressEvent(Link link,
char keychar,
int keycode,
int keylocation,
int keymodifiers,
int keymodifiersex,
ReplyMessageCallback callback)
Sends information about which key was pressed. |
MessageInfo |
sendNoToneMessage(Link link,
int pin)
Sends the request to stop the generation of a tone (square wave) |
MessageInfo |
sendNoToneMessage(Link link,
int pin,
ReplyMessageCallback callback)
Sends the request to stop the generation of a tone (square wave) |
MessageInfo |
sendPowerPinIntensity(Link link,
int pin,
int intensity)
Sends the request to set a PWM type pin to a certain intensity. |
MessageInfo |
sendPowerPinIntensity(Link link,
int pin,
int intensity,
ReplyMessageCallback callback)
Sends the request to set a PWM type pin to a certain intensity. |
MessageInfo |
sendPowerPinSwitch(Link link,
int pin,
int power)
Sends the request to set a pin to HIGH or LOW power. |
MessageInfo |
sendPowerPinSwitch(Link link,
int pin,
int power,
ReplyMessageCallback callback)
Sends the request to set a pin to HIGH or LOW power. |
MessageInfo |
sendToneMessage(Link link,
int pin,
int frequency)
Sends the request to generate a tone (square wave) |
MessageInfo |
sendToneMessage(Link link,
int pin,
int frequency,
int duration)
Sends the request to generate a tone (square wave) |
MessageInfo |
sendToneMessage(Link link,
int pin,
int frequency,
int duration,
ReplyMessageCallback callback)
Sends the request to generate a tone (square wave) |
MessageInfo |
sendToneMessage(Link link,
int pin,
int frequency,
ReplyMessageCallback callback)
Sends the request to generate a tone (square wave) |
MessageInfo |
startListenAnalogPin(Link link,
int pin)
Sends the request to listen on a specific analog pin. |
MessageInfo |
startListenAnalogPin(Link link,
int pin,
ReplyMessageCallback callback)
Sends the request to listen on a specific analog pin. |
MessageInfo |
startListenDigitalPin(Link link,
int pin)
Sends the request to listen on a specific pin. |
MessageInfo |
startListenDigitalPin(Link link,
int pin,
ReplyMessageCallback callback)
Sends the request to listen on a specific pin. |
MessageInfo |
stopListenAnalogPin(Link link,
int pin)
Sends the request to not listen on a specific analog pin. |
MessageInfo |
stopListenAnalogPin(Link link,
int pin,
ReplyMessageCallback callback)
Sends the request to not listen on a specific analog pin. |
MessageInfo |
stopListenDigitalPin(Link link,
int pin)
Sends the request to not listen on a specific pin. |
MessageInfo |
stopListenDigitalPin(Link link,
int pin,
ReplyMessageCallback callback)
Sends the request to not listen on a specific pin. |
Field Detail |
---|
static final int POWER_HIGH
static final int POWER_LOW
static final int HIGH
static final int LOW
static final int UNDEFINED_ID
static final int UNDEFINED_REPLY
static final int REPLY_OK
static final int REPLY_KO
static final byte DEFAULT_INCOMING_MESSAGE_DIVIDER
static final byte DEFAULT_OUTGOING_MESSAGE_DIVIDER
Method Detail |
---|
MessageInfo sendKeyPressEvent(Link link, char keychar, int keycode, int keylocation, int keymodifiers, int keymodifiersex)
link
- keychar
- keycode
- keylocation
- keymodifiers
- keymodifiersex
-
MessageInfo sendPowerPinIntensity(Link link, int pin, int intensity)
link
- pin
- intensity
-
MessageInfo sendPowerPinSwitch(Link link, int pin, int power)
link
- pin
- power
-
MessageInfo sendToneMessage(Link link, int pin, int frequency)
link
- pin
- frequency
-
MessageInfo sendToneMessage(Link link, int pin, int frequency, int duration)
link
- pin
- frequency
- duration
-
MessageInfo sendNoToneMessage(Link link, int pin)
link
- pin
-
MessageInfo sendCustomMessage(Link link, String message)
link
- message
-
MessageInfo sendKeyPressEvent(Link link, char keychar, int keycode, int keylocation, int keymodifiers, int keymodifiersex, ReplyMessageCallback callback)
link
- keychar
- keycode
- keylocation
- keymodifiers
- keymodifiersex
- callback
-
MessageInfo sendPowerPinIntensity(Link link, int pin, int intensity, ReplyMessageCallback callback)
link
- pin
- intensity
- callback
-
MessageInfo sendPowerPinSwitch(Link link, int pin, int power, ReplyMessageCallback callback)
link
- pin
- power
- callback
-
MessageInfo sendToneMessage(Link link, int pin, int frequency, ReplyMessageCallback callback)
link
- pin
- frequency
- callback
-
MessageInfo sendToneMessage(Link link, int pin, int frequency, int duration, ReplyMessageCallback callback)
link
- pin
- frequency
- duration
- callback
-
MessageInfo sendNoToneMessage(Link link, int pin, ReplyMessageCallback callback)
link
- pin
- callback
-
MessageInfo sendCustomMessage(Link link, String message, ReplyMessageCallback callback)
link
- message
- callback
-
IncomingMessageEvent parseMessage(int[] realMsg)
realMsg
-
MessageInfo startListenDigitalPin(Link link, int pin)
link
- pin
-
MessageInfo stopListenDigitalPin(Link link, int pin)
link
- pin
-
MessageInfo startListenAnalogPin(Link link, int pin)
link
- pin
-
MessageInfo stopListenAnalogPin(Link link, int pin)
link
- pin
-
MessageInfo startListenDigitalPin(Link link, int pin, ReplyMessageCallback callback)
link
- pin
- callback
-
MessageInfo stopListenDigitalPin(Link link, int pin, ReplyMessageCallback callback)
link
- pin
- callback
-
MessageInfo startListenAnalogPin(Link link, int pin, ReplyMessageCallback callback)
link
- pin
- callback
-
MessageInfo stopListenAnalogPin(Link link, int pin, ReplyMessageCallback callback)
link
- pin
- callback
-
String getProtocolName()
IProtocol.ProtocolType getProtocolType()
int getIncomingMessageDivider()
int getOutgoingMessageDivider()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |