XBee command to transmit or receive Dn status - xbee

I have two XBee chips - one of them is connected to a relay switch, the other one - to my computer via USB cable.
I can configure the locally connected XBee to send its D0 value to the remote XBee, so that when I toggle the D0 line of the local XBee the remote relay switch toggles as well.
What I want to do is be able to send a command to the local XBee over its serial connection and have the local XBee send a command to the remote XBee that would toggle the relay switch without having to physically interact with the D0 line on my local XBee.
The XBees are S1, so they don't (seem to?) support ATIO command, at least my tests didn't show that working. I also tried using ATAP 1 with API command 83 as shown here but that didn't work.
The hardware setup works - attaching a button to D0 transmits its status to the remote XBee, so how do I get the same to happen with software alone?

You need to send a "Remote AT Command" frame, for parameter ATD0, as described in this page on Digi's website.
Although that page is for the Series 2 radio modules, if you look at the documentation for the Series 1, you can find the frame format for a remote AT command.
And, if you're going to use C to send the command, this Open Source, portable, ANSI C XBee Host Library includes a function process_command_remote() in samples/common/_atinter.c to send a remote AT command.

Finally figured it out, thanks for steering me in the right direction #tomlogic
The problem was that Digi's website doesn't tell you to set IA to 0xFFFF (allow all source addresses to change pin state), which by default is 0xFFFF FFFF FFFF FFFF (disable remote pin changes)
Found a better tip on this site.
This is what it looks like in XCTU for Mac:
Here are all the settings that differ from defaults one I got it to work.
Transmitter:
MY=7
AP=1 (API enabled)
D0=3 (Pin 0 Input)
IC=FF (Change detect all)
Receiver:
MY=2
D0=5 (Pin 0 High Output)
IU=0 (UART IO Disable)
IA=0xFFFF (Allow all to change pins)
The commands I used:
7E 00 10 17 01 00 13 A2 00 AA BB CC DD FF FE 02 49 4F 00 8D - Send remote ATIO 0
7E 00 10 17 01 00 13 A2 00 AA BB CC DD FF FE 02 49 4F 01 8C - Send remote ATIO 1

Related

get wifi security type using SIOCSIWSCAN ioctl for WEP network

I'm trying to scan the list of available networks and enumerate the security type for each SSID. I'm at a point where I can issue a SIOCSIWSCAN ioctl and parse the results. However, when I try to differentiate between a WEP network and an open network, I seem to be getting the same type of IE from the AP.
For example, I configured my Dlink DIR-655 router to be of open type vs WEP.
Since the network is a WEP network, I look for the hex byte 0xDD to tell me that this is an IE describing a WPA/WEP/open network. For this case, I only get one byte that says 0xDD for both open and WEP networks and the corresponding IE looks the same for both:
DD 18 00 50 F2 02 01 01 83 00 03 A4 00 00 27 A4 00 00 42 43 5E 00 62 32 2F 00
Does that mean that the router doesn't populate information about open networks under the byte 0xDD and I should be looking somewhere else?
PS: I've been reverse engineering the source from iwlist to tell me how to read the IEs returned. But they only seem to be describing WPA and WPA2 networks

Explain the hex of the OID portion of an SNMP GET REQUEST message

So I've been working on coding the C version of an SNMPGET request on linux. I open a UDP socket, form the message, and send it out only to continually get a reply saying the OID isn't found. The OID I was using was:
1.3.6.1.2.1.1.1.0
Hex:
00 03 06 01 02 01 01 01 00
After running tcpdump on the packets being sent by snmpget, I realized that even with the same OID the packet being sent actually contained the hex:
2B 06 01 02 01 01 01 00
When I tried that hex with my program it worked. So, question is, why is it 2B instead of 01 03? I've looked everywhere but I can't wrap my head around the logic of it. It seems that every SNMP get message is sent this way where the iso.org translates to 2B but I've yet to see a reason why.
First two numbers (1.3 in your case) are encoded differently. The calculation will be:
1*40 + 3 = 43(dec) = 2B(hex).
That's the reason for your 2B.
Read this for more info.
And here is an online tool to encode/decode.

Unable to read information from Contact VISA Card using APDU commands

I am using the Telpo TPS300 POS terminal to try and read information from a VISA bank Card. The terminal comes with C libraries so sending commands is a lot more easier. However the when I run the SELECT APDU command
(00 A4 04 00 )Lc=0, it returns the following hex data 18byte long as below
6F 10 84 08 A0 00 00 00 03 00 00 00 A5 04 9F 65 01 FF.
I read the ISO 7816-4 specification and the EMV specification and from the look of things, my returned data seems to be lacking one of the mandatory tag 88 as specified in EMV Specification 11.3.4
When I try to SELECT the returned DF name i.e one with tag 84 (A0 00 00 00 03 00 00 00), it returns the same information. All other commands were not successful as well specifically I tried READ RECORD, VERIFY, GET PROCESSING OPTIONS, GET CHALLENGE and they all return the SW 6D 00 (Instruction code not supported or invalid). I just want to retrieve user info from the card and perform an offline authentication of the PIN using the verify command.
I have looked around the web but no one seems to answer me. I have read the standard ISO 7816-4 and EMV Specification again and again on the commands and response interactions but no luck so far because I can't go beyond this step (SELECT command response)
I am using the Telpo TPS300 POS terminal to try and read information from a VISA bank Card
As you said you tried with blank card , here information is coming from card is correct.
when you send select command like,
00 A4 04 00 00 , it select ISD - Issuer Security Domain and return ISD AID i.e. A0 00 00 00 03 00 00 00 with tag 9F 65 that means -Maximum length of data field in command message
Recv - 6F 10 84 08 A0 00 00 00 03 00 00 00 A5 04 9F 65 01 FF
what you receive showing AID of ISD and value of tag 9F65. it seems correct.
my returned data seems to be lacking one of the mandatory tag 88 as specified in EMV Specification 11.3.4
Tag 88 -SFI of the Directory Elementary File is come out from card when you select PSE directory with using command,
00 A4 04 00 0E 315041592E5359532E4444463031 (select PSE command)
it will give you tag 88 if PSE is installed in the card.
I tried READ RECORD, VERIFY, GET PROCESSING OPTIONS, GET CHALLENGE and they all return the SW 6D 00 (Instruction code not supported or invalid).
for reading emv card, EMV application should be installed and personalize in the card then only you can get information from the card with using sequence of commands. try- how to read emv card
it gives basic idea to read emv card with sequence of commands.
hope it helps you..

can xbee as router scan all end device with "ATAS active scan command"? or Are there another way?

If i buy 7 xbee-zigbee. I setup xbee modules like this.
1 coordinator (C)
3 router (R1-R2 -R3)
3 end device (ED1 - ED2 - ED3)
Can a router scan all end device with "AS" (active scan) command?
Result must be like this;
R1 get rssi value from ED1 : -90 dbm
R1 get rssi value from ED2 : -60 dbm
R1 get rssi value from ED3 : -80 dbm​
R2 get rssi value from ED1 : -40 dbm
R2 get rssi value from ED2 : -55 dbm
R2 get rssi value from ED3 : -89 dbm​
R3 get rssi value from ED1 : -23 dbm
R3 get rssi value from ED2 : -10 dbm
R3 get rssi value from ED3 : -70 dbm​
Is this possible? Or is there another way?
Devices will only respond to a Beacon Request (Active Scan) if they are in the "RX on when idle" configuration. This mostly means Routers (and the Coordinator).
There are a few different types of End Device. If they indicates in their Device Announce message that they are "RX on when idle" then they should respond to Beacon Requests. Very few devices actually work this way (a few light bulbs). Most End Devices are battery powered and will not respond to Beacon Requests because they aren't on to hear them.
The ATAS command was designed for network discovery, and you use it when you aren't connected to an active network. The XBee module will scan multiple channels for networks and dump information on each beacon it receives on those channels. Since you can't join a network through an end device, you're not going to see beacons coming from those devices.
You might be more interested in exploring the ATND (Node Discovery) command, for getting a list of devices on the current network.
Mvut from digi said this:"you can use the S2C ZB module and use the ZDO commands to report the Link status." Any body try this?
you can try API mode , it can sent Remote AT command(0x17) and sent back response(0x97) .
something like:
7E 00 0F 17 01 00 00 00 00 00 00 FF FF FF FF 02 64 62 23
0x7E - package start
0x00、0x0F - package length
0x17 - frame type
0x01 - ! this byte is important about if you want to get the response or not
...
I hope it can help for you~

Creating applications on MIFARE DESFire EV1 cards

I have a project to create attendance system using MIFARE DESFIRE EV1 cards.
The reader brand that I need to use for this project only supports ISO 7816-x so I need to use DESFIRE ISO7816-4 APDU Wrapping mode to send commands to Card Reader.
I also have access to NXP document resources.
Up to now I can run A few commands like Get Version, Get Application IDs, Free Memory on card.
all these commands can be run in plain with no security required.
however I couldn't create application on this card yet.
I'm sure my command for creating application is correct but it is failing with code 0x7E (Length Error).
here is my create application code which is failing.
-> 90 CA (00 00 05) 414141 0F 0E (00)
<- 91 7E
I like to know:
Am I running the command in correct sequence?
Is it required to authenticate before creating applications in card
The last byte represent the number of keys you want to use in that application. For every Desfire card, only 14 keys can be created per application. So, the number of keys should be from 0x01 to 0x0E.
This command creates an application for me (with AES keys, hence the 0x80 bit in the num_keys byte).
(90) ca (00 00 05) 33 22 11 0b 84 (00)

Resources