本文整理汇总了Java中com.illposed.osc.OSCMessage类的典型用法代码示例。如果您正苦于以下问题:Java OSCMessage类的具体用法?Java OSCMessage怎么用?Java OSCMessage使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OSCMessage类属于com.illposed.osc包,在下文中一共展示了OSCMessage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: dispatchMessage
import com.illposed.osc.OSCMessage; //导入依赖的package包/类
/**
* Dispatch message.
*
* @param message
* the message
* @param time
* the time
*/
private void dispatchMessage(OSCMessage message, Date time)
{
Enumeration<String> keys = addressToClassTable.keys();
while (keys.hasMoreElements())
{
String key = keys.nextElement();
// this supports the OSC regexp facility, but it
// only works in JDK 1.4, so don't support it right now
// if (key.matches(message.getAddress())) {
if (key.equals(message.getAddress()))
{
OSCListener listener = addressToClassTable.get(key);
listener.acceptMessage(time, message);
}
}
}
示例2: convertMessage
import com.illposed.osc.OSCMessage; //导入依赖的package包/类
/**
* Converts the byte array to a simple message.
* Assumes that the byte array is a message.
* @return a message containing the data specified in the byte stream
*/
private OSCMessage convertMessage() {
OSCMessage message = new OSCMessage();
message.setAddress(readString());
List<Character> types = readTypes();
if (null == types) {
// we are done
return message;
}
moveToFourByteBoundry();
for (int i = 0; i < types.size(); ++i) {
if ('[' == types.get(i).charValue()) {
// we're looking at an array -- read it in
message.addArgument(readArray(types, ++i).toArray());
// then increment i to the end of the array
while (types.get(i).charValue() != ']') {
i++;
}
} else {
message.addArgument(readArgument(types.get(i)));
}
}
return message;
}
示例3: addListener
import com.illposed.osc.OSCMessage; //导入依赖的package包/类
@Override
public void addListener(String source, PdListener listener) {
Array<PdListener> listeners = this.listeners.get(source);
if(listeners == null){
Collection<Object> args = new ArrayList<Object>();
args.add(1);
OSCMessage msg = new OSCMessage("/subscribe/" + source, args);
try {
sender.send(msg);
} catch (IOException e) {
throw new PdRuntimeException(e);
}
this.listeners.put(source, listeners = new Array<PdListener>());
}
listeners.add(listener);
}
示例4: cursorDelete
import com.illposed.osc.OSCMessage; //导入依赖的package包/类
/**
* Cursor delete.
*/
public void cursorDelete()
{
OSCBundle cursorBundle = new OSCBundle();
OSCMessage remoteMessage = new OSCMessage("/tuio/2Dcur");
remoteMessage.addArgument("source");
remoteMessage.addArgument("vision");
OSCMessage aliveMessage = new OSCMessage("/tuio/2Dcur");
aliveMessage.addArgument("alive");
cursorBundle.addPacket(remoteMessage);
cursorBundle.addPacket(aliveMessage);
sendOSC(cursorBundle);
}
示例5: multiCursorMessage
import com.illposed.osc.OSCMessage; //导入依赖的package包/类
/**
* Multi cursor message.
*
* @param cursors
* the cursors
*/
public void multiCursorMessage(IndividualCursor[] cursors)
{
OSCBundle cursorBundle = new OSCBundle();
OSCMessage remoteMessage1 = new OSCMessage("/tuio/2Dcur");
remoteMessage1.addArgument("source");
remoteMessage1.addArgument("vision");
OSCMessage aliveMessage1 = new OSCMessage("/tuio/2Dcur");
aliveMessage1.addArgument("alive");
for (int i = 0; i < cursors.length; i++)
{
aliveMessage1.addArgument(new Integer(cursors[i].id));
}
cursorBundle.addPacket(remoteMessage1);
cursorBundle.addPacket(aliveMessage1);
for (int i = 0; i < cursors.length; i++)
{
addCursorInfoToBundle(cursors[i], cursorBundle);
}
sendOSC(cursorBundle);
}
示例6: reset
import com.illposed.osc.OSCMessage; //导入依赖的package包/类
/**
* Reset.
*/
public void reset()
{
OSCBundle oscBundle = new OSCBundle();
OSCMessage remoteMessage = new OSCMessage("/tuio/2Dobj");
remoteMessage.addArgument("source");
remoteMessage.addArgument("vision");
OSCMessage aliveMessage = new OSCMessage("/tuio/2Dobj");
aliveMessage.addArgument("alive");
currentFrame++;
OSCMessage frameMessage = new OSCMessage("/tuio/2Dobj");
frameMessage.addArgument("fseq");
frameMessage.addArgument(new Integer(currentFrame));
oscBundle.addPacket(remoteMessage);
oscBundle.addPacket(aliveMessage);
oscBundle.addPacket(frameMessage);
sendOSC(oscBundle);
}
示例7: singleCursorMessage
import com.illposed.osc.OSCMessage; //导入依赖的package包/类
/**
* Single cursor message.
*
* @param cursorInfo
* the cursor info
*/
public void singleCursorMessage(IndividualCursor cursorInfo)
{
OSCBundle cursorBundle = new OSCBundle();
OSCMessage remoteMessage = new OSCMessage("/tuio/2Dcur");
remoteMessage.addArgument("source");
remoteMessage.addArgument("vision");
OSCMessage aliveMessage = new OSCMessage("/tuio/2Dcur");
aliveMessage.addArgument("alive");
aliveMessage.addArgument(new Integer(cursorInfo.id));
cursorBundle.addPacket(remoteMessage);
cursorBundle.addPacket(aliveMessage);
addCursorInfoToBundle(cursorInfo, cursorBundle);
sendOSC(cursorBundle);
}
示例8: testSettingLabelOnWithOSC
import com.illposed.osc.OSCMessage; //导入依赖的package包/类
/**
* Testing /togN/labelOn
*/
public void testSettingLabelOnWithOSC() throws IOException {
ToggleOSCWrapper tog = getActivity().getToggleWrappers().get(0);
assertEquals("Initially toggle on label should be set by config", "tog_on1", tog.getOnLabel());
final CountDownLatch signal = new CountDownLatch(1);
final Collection<Object> args = new ArrayList<Object>();
args.add("hello");
args.add("world");
mOscOut.send(new OSCMessage("/tog1/labelOn", args));
try {
signal.await(2, TimeUnit.SECONDS);
} catch (Exception e) {
e.printStackTrace();
}
assertEquals("tog labelOn should be set by OSC", "hello world", tog.getOnLabel());
}
示例9: testSettingLabelOffWithOSC
import com.illposed.osc.OSCMessage; //导入依赖的package包/类
/**
* Testing /togN/labelOff
*/
public void testSettingLabelOffWithOSC() throws IOException {
ToggleOSCWrapper tog = getActivity().getToggleWrappers().get(0);
assertEquals("Initially toggle off label should be set by config", "tog_off1", tog.getOffLabel());
final CountDownLatch signal = new CountDownLatch(1);
final Collection<Object> args = new ArrayList<Object>();
args.add("hello");
args.add("world");
mOscOut.send(new OSCMessage("/tog1/labelOff", args));
try {
signal.await(2, TimeUnit.SECONDS);
} catch (Exception e) {
e.printStackTrace();
}
assertEquals("tog labelOff should be set by OSC", "hello world", tog.getOffLabel());
}
示例10: testSettingToggledOnMsgWithOSC
import com.illposed.osc.OSCMessage; //导入依赖的package包/类
/**
* Testing /togN/msgToggledOn
*/
public void testSettingToggledOnMsgWithOSC() throws IOException {
ToggleOSCWrapper tog = getActivity().getToggleWrappers().get(0);
assertEquals("Initially toggle msgToggledOn value should be set by config", "/tog1/1", tog.getMessageToggleOnRaw());
final CountDownLatch signal = new CountDownLatch(1);
final Collection<Object> args = new ArrayList<Object>();
args.add("/hello");
args.add("world");
mOscOut.send(new OSCMessage("/tog1/msgToggledOn", args));
try {
signal.await(2, TimeUnit.SECONDS);
} catch (Exception e) {
e.printStackTrace();
}
assertEquals("tog msgToggledOn value should be set by OSC", "/hello world", tog.getMessageToggleOnRaw());
}
示例11: testSettingToggledOffMsgWithOSC
import com.illposed.osc.OSCMessage; //导入依赖的package包/类
/**
* Testing /togN/msgToggledOff
*/
public void testSettingToggledOffMsgWithOSC() throws IOException {
ToggleOSCWrapper tog = getActivity().getToggleWrappers().get(0);
assertEquals("toggle msgToggledOff value should be set by config", "/tog1/0", tog.getMessageToggleOffRaw());
final CountDownLatch signal = new CountDownLatch(1);
final Collection<Object> args = new ArrayList<Object>();
args.add("/hello");
args.add("world");
mOscOut.send(new OSCMessage("/tog1/msgToggledOff", args));
try {
signal.await(2, TimeUnit.SECONDS);
} catch (Exception e) {
e.printStackTrace();
}
assertEquals("tog msgToggledOff value should be set by OSC", "/hello world", tog.getMessageToggleOffRaw());
}
示例12: testSetButtonLabelWithOSC
import com.illposed.osc.OSCMessage; //导入依赖的package包/类
/**
* Testing /btnN/label OSC message
* @throws Throwable
*/
public void testSetButtonLabelWithOSC() throws Throwable {
final CountDownLatch signal = new CountDownLatch(1);
final Collection<Object> args = new ArrayList<Object>();
args.add("hello");
new AsyncSendOSCTask(getActivity(), QuickOSCMessageReceiveTests.this.mOscOut).execute(new OSCMessage("/btn1/label", args));
try {
signal.await(2, TimeUnit.SECONDS);
} catch (Exception e) {
e.printStackTrace();
}
Button btn1 = (Button) getActivity().findViewById(R.id.button1);
assertEquals("btn1 text should be", "hello", btn1.getText().toString());
}
示例13: testSetToggleOffLabelWithOSC
import com.illposed.osc.OSCMessage; //导入依赖的package包/类
/**
* Testing /togN/labelOff OSC message
* @throws Throwable
*/
public void testSetToggleOffLabelWithOSC() throws Throwable {
final CountDownLatch signal = new CountDownLatch(1);
final Collection<Object> args = new ArrayList<Object>();
args.add("hello");
new AsyncSendOSCTask(getActivity(), QuickOSCMessageReceiveTests.this.mOscOut).execute(new OSCMessage("/tog1/labelOff", args));
try {
signal.await(2, TimeUnit.SECONDS);
} catch (Exception e) {
e.printStackTrace();
}
ToggleButton btn1 = (ToggleButton) getActivity().findViewById(R.id.toggleButton1);
assertEquals("tog1 off should be", "hello", btn1.getTextOff().toString());
}
示例14: testSetToggleOnStateWithOSC
import com.illposed.osc.OSCMessage; //导入依赖的package包/类
/**
* Testing /togN/labelOn OSC message
* @throws Throwable
*/
public void testSetToggleOnStateWithOSC() throws Throwable {
final CountDownLatch signal = new CountDownLatch(1);
final Collection<Object> args = new ArrayList<Object>();
args.add(1);
new AsyncSendOSCTask(getActivity(), QuickOSCMessageReceiveTests.this.mOscOut).execute(new OSCMessage("/tog1/value", args));
try {
signal.await(2, TimeUnit.SECONDS);
} catch (Exception e) {
e.printStackTrace();
}
ToggleButton btn1 = (ToggleButton) getActivity().findViewById(R.id.toggleButton1);
assertTrue("tog1 should be on", btn1.isChecked());
}
示例15: testSetToggleStateOffWithOSC
import com.illposed.osc.OSCMessage; //导入依赖的package包/类
/**
* Testing /togN/value 0
* @throws Throwable
*/
public void testSetToggleStateOffWithOSC() throws Throwable {
final CountDownLatch signal = new CountDownLatch(1);
final Collection<Object> args = new ArrayList<Object>();
args.add(0);
new AsyncSendOSCTask(getActivity(), QuickOSCMessageReceiveTests.this.mOscOut).execute(new OSCMessage("/tog1/value", args));
try {
signal.await(2, TimeUnit.SECONDS);
} catch (Exception e) {
e.printStackTrace();
}
ToggleButton btn1 = (ToggleButton) getActivity().findViewById(R.id.toggleButton1);
assertFalse("tog1 should be off", btn1.isChecked());
}