private static void pubTest() { String scope = "0000000000000000"; print("2. Publish test"); print("Publishing scope " + scope); wrapper.publishScope(BAWrapperShared.c_hex_to_char(scope), new byte[0], strategy, null); String item = "0101010101010101"; print("Sleep 3s"); try { Thread.sleep(3000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } print("Publishing item " + scope + "/" + item); wrapper.publishItem( BAWrapperShared.c_hex_to_char(item), BAWrapperShared.c_hex_to_char(scope), strategy, null); }
private static void utilTest() { // util function test String hex_str = "0a000001"; print("1. Conversion utility test"); print("Testing c_hex_to_char: original value " + hex_str); byte[] cvtChar = BAWrapperShared.c_hex_to_char(hex_str); print(printbytes(cvtChar)); print("Testing c_char_to_hex: original value " + printbytes(cvtChar)); String s = BAWrapperShared.c_char_to_hex(cvtChar); print(s); if (hex_str.equals(s)) { print("Test successful!"); } else { print("Test failed!"); } }
private static void subTest() { String room = "0000000000000000"; print("3. Subscribe test"); print("subscribing scope: " + "/" + room); wrapper.subscribeScope(BAWrapperShared.c_hex_to_char(room), new byte[0], strategy, null); // print("subscribing item " + scope); // String item = "0101010101010101"; // wrapper.subscribeItem(BAWrapperShared.c_hex_to_char(item), // BAWrapperShared.c_hex_to_char(scope), strategy, null); }