How to get the IMEI of a Java ME device in a common way that is applicable to all devices
Usually, using java.lang.System.getProperty() can return the device IMEI.
Unfortunately, the String parameter you need to use to get the IMEI will change from one handset manufacturer to the next.
Strings to try:
imei
phone.imei
com.lge.imei
com.nokia.imei
com.nokia.mid.imei
com.siemens.imei
com.sonyericsson.imei
com.motorola.imei
...
you get the idea.
you may need to uppercase the last part of the string.
the format of the result can change too.
it can be a full imei with a "IMEI" prefix and 3 "-" in the middle of 17 digits.
it can be a normalized imei of 13 or 15 digits...
there is no standard way to get the IMEI via Java ME. some phones expose the IMEI as a system property, but others don't or require the midlet to be signed to operator or manufacturer domain (ie. not by you).
In the game i'm developing, to get an unique id for every cellphone (so that they can't duplicate and share savefiles) i use the bluetooth mac address that is different for every single bluetooth device and the java code to get it is the same on every device =D
I have tried what is suggested by both ax and quickrecipeonsymbianos however they both solve the purpose in an elegant way. However, in the BlackBerry we have the getDeviceID() to get the unique id of the device, but Java ME lacks this functionality
Related
I am using devcon to query a verifone device to get the serial number and I a trying to find the serial number below "123-552-666" and output that to a text file. I have been playing around with various commands but just cant seem to get it.
I have used this:
findstr /RC:"[0-9][0-9][0-9]-[0-9][0-9][0-9]-[0-9][0-9][0-9]" "verifone1.txt"
But just got this lie returned
USB\VID_11CA&PID_0300\123-552-666_____
Below is the full data I am searching. Would appreciate any assistance
USB\VID_11CA&PID_0300\123-552-666_____
Name: Verifone V,P Family USB UART device (COM7)
Driver is running.
I'm new to GSM AT Commands and I'm using ZTE MF190S USB 3G USB Modem with Modem Nodejs Module also tried with MS Hyperterminal.
The problem I'm facing that when I receive SMS using AT+CMGL="ALL" from Whatsapp (as example) I got in sender number field 81084326797126204 which is an invalid phone number and should be "Whatsapp" instead although the manufacture's software is showing message from Whatsapp normally.
Note: I tried to decode it as a Hexadecimal string but not done.
> AT+CSCS="GSM"
> AT+CPMS="ME"
> AT+CMGL="ALL"
//Result
+CMGL: 0,"REC UNREAD","81084326797126204",,"20/05/30,14:53:55+08"
FEFF000000000000000000000000000000000000020
As described in this link
+CMGL: index,message_status,address,[address_text],[service_center_time_stamp][,address_type,sms_message_body_length]sms_message_body[+CMGL:
...]
The address Field
The third field of the information response of the +CMGL AT command,
address, is a string that contains the address/phone number stored in
the SMS message header. If the SMS message read is an incoming SMS
message, the address field contains the originator address. If the SMS
message read is an outgoing SMS message, the address field contains
the recipient address. Usually the address field value is a phone
number formatted using the typical ISDN / telephony numbering plan
(ITU E.164/E.163). For example, "+85291234567".
The address_text Field
The fourth field of the information response of the +CMGL AT command,
address_text, is a string that contains the text associated to address
in the phonebook. For example, if the text "Alice" is associated to
the phone number "91234567" in the phonebook, address_text will be
"Alice". The AT command +CSCS (command name in text: Select TE
Character Set) can be used to specify the character set for displaying
address_text. Note that address_text is an optional field. Some
GSM/GPRS modems and mobile phones (examples: most Nokia products,
including my Nokia 6021) leave this field empty.
How can I identify the message is from Whatsapp or any other services providers names?
You wrote
The fourth field of the information response of the +CMGL AT command, address_text, is a string that contains the text associated to address in the phonebook
If your device used to recognize that number, it probably was in one of device's phonebooks, and maybe it got deleted.
What you can try to do is to store again the number using AT+CPBW command:
AT+CPBW=[<index>][,<number>[,<type>[,<text>]]]
where
index is the record position in the phonebook. If omitted the record is stored in the first free position
number is the number to be stored in phonebook, in string format
type is the number type; 129 for national scheme, 145 for international scheme
text is the name of the entry in the phonebook
So, in your case:
AT+CPBW=,"81084326797126204",129,"WhatsApp"
And after it you should see the name appearing in +CGML list. You might need a device reboot after the PB write in order to see the change making effect.
The change is done in the current phonebook, usually the SIM card. It can be queried with command AT+CPBS? (it also allows to change it; see the guide for further explanation).
I suggest exploring the content of every phonebook, in order to discover any device (and SIM) default contents. The command to read phonebook entries is **AT+CPBR**. Providing
AT+CPBR=1,N
all index between 1 and N are shown. If you set N to the size of the phonebook, you can list all the entries in it.
I am using WiPy 2.0 Pycom Board.
When trying to resolve the names of the available devices the names are not resolved properly.
bluetooth.resolve_adv_data(adv.data,Bluetooth.ADV_NAME_CMPL)
This line prints the following data.
None
HE<�#?�'�?
When print the short name
bluetooth.resolve_adv_data(adv.data,Bluetooth.ADV_NAME_SHORT)
It prints out "None"
How to get the proper name of the scanned devices. I am new to this
Thank you!
Using manufacturer data, we can get the proper data from the sensor.
mfg_data = bluetooth.resolve_adv_data(adv.data, Bluetooth.ADV_MANUFACTURER_DATA)
advData = binascii.hexlify(mfg_data)
I have a Zebra RFD8500 here and I connected to it via the terminal. I am trying to use the ZETI command read to access epc's, but it does not read anything.
But if I use the ZETI command inventory it finds all the tags around.
Anyone knows how to use the read command properly? Also is there some kind of filter per default on?
I am using the developer example on page 174 Link to PDF
Not sure if you solved this problem, but I couldn't find anything else via Google. I had the same problem with using read in ZETI (Zebra RFD8500). The Zebra tech support told me that to use access operations like read and write, you have to turn off dynamic power (which I think is on by default).
Unfortunately, I am not using the iOS API/SDK (writing a custom one for another device), but here's the gist of what you'd be doing:
Turn off dynamic power
Do an inventory
Read some memory bank, like the EPC bank. Optionally, you can also specify access criteria to single out a tag.
To test how this worked in ZETI, I screened into the RFD8500 (on my Mac, doing ls /dev/tty.RFD* lists several ttys, I chose the one ending in "-R"):
screen /dev/tty.RFD8500{long number}-R
Then I issued these commands:
dp .disable
in
rd
Commands:
dp = setdynamicpower
in = inventory
rd = read
After issuing "rd", you should be able to see the user memory banks (the default bank for the "rd" command).
I want to send data hex format (0x01) or (0xff) to the port where rs232 cable is connected. I am using the MSCOMM control in VC++ 6.0. Is that the correct way to send the hex data. This is the code I have.
CString output;
UCHAR data1,data2;
data1=0x01;
output.Format("%x",data1);
m_mscom.SetOutput(COleVariant(output));
data2=0xff;
output.Format("%x",data2);
m_mscom.SetOutput(COleVariant(output));
If it is not correct, please tell me how to send hex format data to the port.
Thanks in Advance
If your data is simply a hex value that you want to send out (as opposed to a hex formatted string), you probably want "%c" rather than "%x". Given a data value of (e.g.) 0x65, "%x" will produce two bytes on the serial port: '6' (ascii value 54) and '5' (ascii value 53). "%c" will produce a single byte on the serial port: 'e' (ascii value 100 or 0x65).
As far as sending data on a serial port in C, have a look at CSerial or CSerialPort: they may simplify things for you a bit (note that I've not used them, I tend to do serial port apps in python with the pyserial module or in wxWidgets with the ctb library).
Edit: The other one that's quite good (I have used it before, but couldn't find the link when I wrote the original post) is CSerialFile, part of the WFC libraries. As I said, I tend to use wxWidgets now, but if you're using the Microsoft foundation classes, CSerialFile does make serial access very easy.
I'm no familiar with MSCOM but it seems like it won't work. Format may re-format the data to an ASCII string representation instead.
Alternatively, you can just use any serial port as a 'file' in Windows. Look at the windows api for opening files and you will see that you can address certain devices as files by using a filename like 'COM1:' instead.
Then, you can read/write from it like a file.