I'm following http://m2m.demos.ibm.com/iotstarter.html
I've connected my phone to the IoT service and could see messages in WebUI but provided Node-Red flow seems couldn't connect to IoT data.
I've connected debug node to the IoT In node and don't see any messages.
Authentication type was 'Bluemix' and changed to 'Quickstart' now. Is it related somehow?
[{"id":"2a8baa.ecd60456","type":"comment","name":"Sample 2: IoT Starter accel to color flow","info":"","x":196,"y":275,"z":"3f16d263.e01496","wires":[]},{"id":"b83ddfdb.7b3368","type":"ibmiot in","authentication":"boundService","apiKey":"","inputType":"evt","deviceId":"","applicationId":"","deviceType":"+","eventType":"accel","commandType":"","format":"json","name":"IBM IoT App In","service":"registered","allDevices":true,"allApplications":"","allDeviceTypes":true,"allEvents":false,"allCommands":"","allFormats":false,"x":117,"y":313,"z":"3f16d263.e01496","wires":[["64ebf370.5a0b5c"]]},{"id":"64ebf370.5a0b5c","type":"function","name":"Handle accel","func":"msg.deviceId = msg.payload.d.deviceId;\nmsg.deviceType = msg.payload.d.deviceType;\nmsg.format = \"json\";\n\nvar accelZ = msg.payload.d.acceleration_z;\nvar r = 0.0;\nvar b = 0.0;\nvar g = 0.0;\nif (accelZ > 0) {\n\tg = 255.0;\n} else if (accelZ < 0) {\n\tr = 255.0;\n} else {\n\tr = 104;\n\tg = 109;\n\tb = 115;\n}\na = 1.0;\n\t\nmsg.eventOrCommandType = \"color\";\nmsg.payload = JSON.stringify({\"d\":{\"deviceId\":msg.deviceId, \"r\":r,\"b\":b,\"g\":g,\"alpha\":a}});\n\nreturn msg;","outputs":1,"x":287,"y":313,"z":"3f16d263.e01496","wires":[["56d70240.c2bd14"]]},{"id":"56d70240.c2bd14","type":"ibmiot out","authentication":"boundService","apiKey":"","outputType":"cmd","deviceId":"AAA","deviceType":"iPhone","eventCommandType":"text","format":"json","data":"{\"d\":{\"value\":\"text\"}}","name":"IBM IoT App Out","service":"registered","x":469,"y":313,"z":"3f16d263.e01496","wires":[]}]
The directions in the tutorial state to populate the properties for the ibmiot output node based on the device that was created in Step 2. You should include the deviceID, API key, etc to match the device you registered to your org.
If you require further assistance, let me know your 6 character org.
Related
I'm having a Local VPN app that using "NETunnelProvider / NetworkExtentsion", In my solution, I created a split tunnel on the device itself to track the DNS request, using NEKit I was able to peek inside the packets and filter the ongoing request based on the destination address (let's call ita UDP listener for DNS requests).
This solution was working fine on iOS 13.7 and less, recently apple release iOS 14, and my solution stop working, VPN connection still established but the user can't access any webSite, I debugged the code and found out the networkExtision does not receive any packets from user activity only.
I'm using the CocoaAsyncSocket library.
func udpSocket(_ sock: GCDAsyncUdpSocket, didReceive data: Data, fromAddress address: Data, withFilterContext filterContext: Any?) {
let host = GCDAsyncUdpSocket.host(fromAddress: address)
guard let message = DNSMessage(payload: data) else {
return
}
guard let session = pendingSession.removeValue(forKey: message.transactionID) else {
return
}
session.realResponseMessage = message
session.realIP = message.resolvedIPv4Address
let domain = session.requestMessage.queries[0].name
let udpParser = UDPProtocolParser()
udpParser.sourcePort = Port(port: dnsServerPort)
udpParser.destinationPort = (session.requestIPPacket!.protocolParser as! UDPProtocolParser).sourcePort
udpParser.payload = session.realResponseMessage!.payload
let ipPacket = IPPacket()
ipPacket.sourceAddress = IPAddress(fromString: dnsServerAddress)
ipPacket.destinationAddress = session.requestIPPacket!.sourceAddress
ipPacket.protocolParser = udpParser
ipPacket.transportProtocol = .udp
ipPacket.buildPacket()
packetFlow.writePackets([ipPacket.packetData], withProtocols: [NSNumber(value: AF_INET as Int32)])
}
let dummyTunnelAddress = "127.0.0.1"
let dnsServerAddress = "8.8.4.4"
let dnsServerPort: UInt16 = 53
// Tunnel confg.
let tunnelAddress = "192.168.0.1"
let tunnelSubnetMask = "255.255.255.0"
Regarding triggering"Local Network permissions" which is not the issue here (I don't think my solution need to have this permission), Based on the apple document some apps need to request local network permissions, I added the permission to the info.plist but local network permissions are not triggered.
==========================
Update #1
============================
I found out that I was able to capture the packets and do my own things then write packets back to the packetFlow packetFlow.writePackets, But on iOS 14 browsers not loading the websites and keep loading until show time out.
I have an idea, and maybe a solution for you. Starting in iOS version 14, the C function connect() started failing in network extensions, where VPNs have to run, with the following log message from the kernel:
Sandbox: VPN Extensio(8335) deny(1) network-outbound*:<port #>
However, it does work in the app, which is next to useless if you need it in the extension. GCDAsyncUdpSocket is a thin layer that right under the covers is calling socket() and connect().
NWConnection does work in a network extension, and it should work for you if it is feasible to port your code and you don't need the actual socket descriptor. But you will have to conditionally compile if you have to support devices < ios 12.
Trying to create a simple xinetd style server without needing to create a full service first. I have the following file which is located at /etc/xinetd.d/myscript:
service tester
{
disable = no
socket_type = stream
protocol = tcp
port = 8087
wait = no
user = root
server = /root/prog
}
but I keep getting the following error when restarting xinetd:
service/protocol combination not in /etc/services
The solution is to add type = UNLISTED as seen below, and as discussed at https://www.redhat.com/archives/fedora-legacy-list/2004-October/msg00146.html
service tester
{
disable = no
socket_type = stream
protocol = tcp
port = 8087
wait = no
user = root
server = /root/prog
type = UNLISTED
}
Hazelcast fails when multiple members disconnect from the cluster.
My scenario is so basic and my configuration has 3 bakcup option(it does not work). I have 4 members in a cluster and i use AtomicLong API to save my key->value. When all members are alive, everything is perfect. However, some data loss occurs when i kill 2 members at the same time(without waiting for a while). My member counts are always 4. is there any way to avoid this kind of data loss?
Config config = new Config();
NetworkConfig network = config.getNetworkConfig();
network.setPort(DistributedCacheData.getInstance().getPort());
config.getCacheConfig("default").setBackupCount(3);
JoinConfig join = network.getJoin();
join.getMulticastConfig().setEnabled(false);
join.getTcpIpConfig().setEnabled(true);
config.setNetworkConfig(network);
config.setInstanceName("member-name-here");
Thanks.
IAtomicLong has hard-coded 1 sync backup, you cannot configure it to have more than 1 backup. What you are doing is configuring Cache with 3 backups.
Below is a example demonstrates multiple member disconnect for IMap
Config config = new Config();
config.getMapConfig("myMap").setBackupCount(3);
HazelcastInstance[] instances = {
Hazelcast.newHazelcastInstance(config),
Hazelcast.newHazelcastInstance(config),
Hazelcast.newHazelcastInstance(config),
Hazelcast.newHazelcastInstance(config)
};
IMap<Integer, Integer> myMap = instances[0].getMap("myMap");
for (int i = 0; i < 1000; i++) {
myMap.set(i, i);
}
System.out.println(myMap.size());
instances[1].getLifecycleService().terminate();
instances[2].getLifecycleService().terminate();
System.out.println(myMap.size());
I am trying to persist my Orion data into the public cosmos.lab.fi-ware.org instance using Cygnus.
Cygnus is up and running and the HDFSSink part of my /usr/cygnus/conf/agent_1.conf looks like this:
# OrionHDFSSink configuration
cygnusagent.sinks.hdfs-sink.channel = hdfs-channel
cygnusagent.sinks.hdfs-sink.type = com.telefonica.iot.cygnus.sinks.OrionHDFSSink
cygnusagent.sinks.hdfs-sink.enable_grouping = false
cygnusagent.sinks.hdfs-sink.backend_impl = rest
cygnusagent.sinks.hdfs-sink.hdfs_host = cosmos.lab.fi-ware.org
cygnusagent.sinks.hdfs-sink.hdfs_port = 14000
cygnusagent.sinks.hdfs-sink.hdfs_username = myUsernameInCosmosLabInstance
cygnusagent.sinks.hdfs-sink.hdfs_password = myPasswordInCosmosLabInstance
cygnusagent.sinks.hdfs-sink.oauth2_token = myTokenForCosmosLabInstance
cygnusagent.sinks.hdfs-sink.hive = true
cygnusagent.sinks.hdfs-sink.hive.server_version = 2
cygnusagent.sinks.hdfs-sink.hive.host = cosmos.lablfi-ware.org
cygnusagent.sinks.hdfs-sink.hive.port = 10000
cygnusagent.sinks.hdfs-sink.hive.db_type = default-db
I add a new subscription with Cygnus as the reference endpoint and I send an update to previously created NGSIEntity, but nothing appears in my cosmos.lab.fi-ware.org instance.
When looking at /var/log/cygnus/cygnus.log I cant find nothing useful, and I find some Java errors.
I am using Orion v. 0.28 and Cygnus v. 0.13.
As the log is saying:
Could not open connection to jdbc:hive2://cosmos.lablfi-ware.org:10000/default: java.net.UnknownHostException: cosmos.lablfi-ware.org
You must configure the right Hive endpoint:
cygnusagent.sinks.hdfs-sink.hive.host = cosmos.lab.fiware.org
Instead of:
cygnusagent.sinks.hdfs-sink.hive.host = cosmos.lablfi-ware.org
NOTE: Youy may have noticed I've used cosmos.lab.fiware.org. Both cosmos.lab.fiware.org and cosmos.lab.fi-ware.org are valid, bit the first one is preferred.
To find the data that Orion was persisting in my Cosmos global instance:
From Hadoop:
# hive
hive> select * from myUsernameInCosmosLabInstance_def_serv_def_servpath_room1_room_column;
Alternative method:
# hadoop fs -ls /user/myUsernameInCosmosInstance/def_serv/def_servpath/Room1_Room/Room1_Room.txt
hello I connect my device android to printers, of the way follows.
bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
BluetoothDevice bluetakebt220 =
bluetoothAdapter.getRemoteDevice(obj.getMac().toString());
BluetoothSocket mBTsocket= null;
bluetoothAdapter.cancelDiscovery();
UUID num = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB");
mBTsocket = bluetakebt220.createRfcommSocketToServiceRecord(num);
mBTsocket.connect();
this works well for for most devices, but some do not connected, ¿that can be due?
The most obvious reason I can think of is the UUID's do not match up. If you are making a generic app you need to have the UUID of each printer. This can be done in the form of a case switch statement.
Code
switch(Mac Address) {
case (Mac Address 1)
UUID = xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx
case (Mac Address 2):
UUID = xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx
default:
UUID = 00001101-0000-1000-8000-00805F9B34FB;
The reason why most of the time your connections works is because 00001101-0000-1000-8000-00805F9B34FB is the generic ID for most off shelf hardware devices (keyboards,mouses,printers,scanners etc). The minute your UUID does not match a connection cannot occur. Read this for more info about UUID's.
the device acts equal, simply does not establish proper connection , but yes allow write in
Here is the code if someone can help
UUID num = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB");
bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
BluetoothDevice bluetakebt220 = bluetoothAdapter.getRemoteDevice(obj.getMac().toString());//PRINTER ADAPTER FOR LPT BLUETAKE BT220
BluetoothSocket mBTsocket= null;
mBTsocket = bluetakebt220.createRfcommSocketToServiceRecord(num);
bluetoothAdapter.cancelDiscovery();
mBTsocket.connect();
OutputStream os = **mBTsocket**.getOutputStream();
os.flush();
byte[] CPCLFormat = null;
PCLFormat = objImpresion.getTexto().getBytes("utf-8");
os.write(CPCLFormat);//se imprime el texto
os.flush();
os.close();
.I simply comment msocket.isConnected and write directly after open connection. i don´t why happen