How to set Data coding to 3 in kannel - kannel

I need to set data_coding value in kannel to 3. But I cant figure out how to do that. I have tried all options available.
I have found that to set dcs to 3 we must set coding to 2 and use LATIN1 charset which I am using but still i get data_coding as 8 and not 3.
Can anyone tell me how to do this.
We can use only three values in coding section that is 0,1 and 2
0 sets data_coding to 0
1 sets it to 4
2 sets it to 8
How to set it to 3.

Try setting mwi & mclass & compress fields in send-sms url.
Note:- Only one out of mwi or mclass can be set.
Let me know if it worked

Related

ASCII control of VFD

All,
I am a new user here, and thought I would see if the experts could help me with something I am new to.
I have been given the following statement to try and solve:
The Variable Frequency Drive (VFD) is connected to the PLC by RS485 communication. The speed of the motor (M2) can be adjusted by sending the following command:
STX N DATA ETX , with each separate value having the <> symbols around them.
Data : Length of data is 1 byte, in which the value of S (Slow), M (Medium) or F (Fast) can be sent.
N : Node number of the VFD, with a data length of two byte ASCII.
My question is, how would I type to send this data? It doesn't say whether to use a specific data type to represent, so surely I could just type the data as it is, e.g. STX 1 S ETX?
Othwerside, I'm not sure how to combine the byte representations of the data, representing them in hex, binary or decimal. I'm not sure what is meant by two byte ASCII, is this not UNICODE-16? Also, I'm not sure if I need to send the values of STX or ETX with the data string or not
I hope someone can shed some light on this.
Thanks in advance.
Since the frequency goes from 0-50 Hz, I think we should send data in this range.
So if we want the frequency to be half maximal, we will send 25.
To send this to VFD, we first need to split that number into 2 and 5
The message should read STX 2 5 ETX?
Now we look at the ASCII code table and find 2 and 5.
0x50 = 2
0x53 = 5
We convey everything in a message that reads
STX 0x50 0x53 ETX
The aforementioned S7-300 is recommended for operation. You can also solve this through his TIA portal.
All,
I managed to figure this out with a bit of digging. I simulated it using Siemens S7-300 on TIA portal, and set up communications on a module. I sent the values I wanted using a "move" block, to a value set in the Data Block.
I repeated this for the Node value, making sure the correct data type was chosen, and sent the data through a Send_ptp command block.
Must have got a bit flustered and tired the other night when I was trying it. Hopefully it might help someone in the future.

Regionprops (connected components) matlab

I get the concept of applying regionprops to extract ROI. Basically, regionprops uses connected components technique to extract the object. But, the thing I wanted to ask is using regionprops on "BoundingBox", what is the default value for connected components (number of connectivity)? I tried searching about it but I could not really find the answer.
I didn't see the default connectivity on regionprops, but the default connectivity for both bwlabel and bwconncomp (for 2-dimensional matrices) is 8-connected. I would expect regionprops to be the same. You should be able to easily determine if this is the case for regionprops by constructing a test image something like this:
1 1 0 0
1 1 0 0
0 0 1 1
0 0 1 1
Alternatively, you could use bwlabel or bwconncomp first and control the connectivity parameter. regionprops accepts the output from either of these, as well as a BW image.
Take a look to the Matlab documentation about regionprops:
https://www.mathworks.com/help/images/ref/regionprops.html
In the section Tips you can see: ''If you need to specify nondefault connectivity, call bwconncomp and then pass the result to regionprops'' as:
CC = bwconncomp(BW, CONN);
S = regionprops(CC);
So answer to you question: It uses default connectivity that is 8, and you can also change it as you want with the parameter CONN when calling bwconncomp.

How to get CPF file to QL420/QL220

I have to provision over 30 QL420plus printers and I'm struggling with what I thought would be easy..
We are going to use the printers in conjunction with an in-house app we have written on Windows Mobile 6. Basically the app sends a stream to of CPCL commands to print a label. As the label has non-standard fonts we have created 7 CPF files that we need to put on the printer.
However the problem is that the new version of LabelVista (now called Zebra Designer v2.2.3) will not let you "Send a Font" like you could in the LabelVista that ran on Windows XP. You have to use the "Zebra Font Downloader". This is where the problem really comes home because it will not let you add a CPF file. You have to create a MMF file and then download it to the printer. This creates one big file which has the various fonts in it. This is pretty useless when the label format looks like this:
! 0 200 200 304 {8}
LABEL
CONTRAST 0
TONE 0
SPEED 3
PAGE-WIDTH 408
BAR-SENSE 50
COUNTRY UK
VT 7 0 280 220 {0}
VB EAN{13} 1 2 60 310 230 {9}
T Got08Bpt.cpf 0 5 3 {1}
T Got05Bpt.cpf 0 5 91 TICKET PRICE
T Got010Bpt.cpf 0 5 220 RETAIL PRICE
T Got012Bpt.cpf 0 5 240 {12}
T Got014Bpt.cpf 0 20 240 {6}
CONCAT 5 105
Got28Bpt.cpf 0 0 {10}
Got14Bpt.cpf 0 7 {11}
ENDCONCAT
FORM
PRINT
I need different font sizes for each text line written on the label, yet I can't download the CPF files individually to the printer.
I can't install the old verison of LabelVista becuase it won't let me install on Windows 7. I have read the CPCL Progrmaming guide from Zebra and that's ot helpful at all. Can anyone help or my Zebra account manager is going to have a really bad day. :-)
Thanks
Mike
Try the code I pasted here Sending a font file (.cpf) to zebra Qln320 printer over WLAN
I store font files in Oracle DB, load them to Windows CE device and send'em via BT to device. The only "bad thing" in this method is that printer off after each file downloading (buy the way when you load font file via USB from LabelVista the problem the same).
To delete file from printer you can use this String.Format("! U1 do \"file.delete\" \"{0}\"\r\n", FileName.ToUpper());
You can use "Zebra Setup Utilitites" to manage your printers. This software allows you to communicate with your printers and to configure them.

How to correctly represent message class in SMPP

I am currently trying to figure out how sms classes are correctly represented in SMPP. However I am by now completely confused by the standard and it's documentation.
In normal sms we have
Class0: Flash sms, which are shown on the display
Class1: Normal Sms to be stored on the sim or internally in the device
Looking at the SMPP spec, I first find the parameter data_coding in the submit_sm operation, which is used to set the DCS sent via MAP. As far as I understand this, if we want to explicitly set the message class we need to set the first four bits of this parameter to ones, then two bits indicating the coding and then another two bits indicating the message class. So for Class1 Sms, we would set 1111xx01. Is this correct so far?
If we try to set this DCS, however currently we also set the data coding to "8-Bit data". It seems, several phones are not able to understand this. Is this specified anywhere, and can we just change this, or is a special coding needed when sending other message classes.
More confusion arises, when we try to use the SMPPv3.4 recommended way of setting the Message class. Since 3.4 there is an optional parameter in the submit_sm operation, called dest_addr_subunit. According to the standard this parameter should be set to 0 for unknown, 1 for MS-Display, 2 for Mobile equipment, etc. If I look at this, it seems the parameters are shifted by one compared to GSM message classes. Class0 is encoded as 1, Class1 is encoded as 2 and so on. Is this correct or is there any more complicated mapping behind this?
Also, if we set dest_addr_subunit, do we still have to set DCS as well, or can we just leave this parameter at it's default value?
I recommend to read 3GPP TS 23.038 specification with detailed DCS (Data Coding Scheme) description.
In case of DCS bits 7654 are 00xx, you should check DCS for bit 4 value.
bit 4 == 0 - no message class for this message (bits 1 and 0 are reserved)
bit 4 == 1 - bits 1 and 0 contains message class
So you should set data_coding SMPP parameter in accordance to 3GPP TS 23.038 specification to handle message_class properly.
By default GSM SMS message has no message_class and this is not the same as message_class = 1.

What's the format of the DefaultConnectionSettings value in the Windows registry?

The Windows registry key
HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections
contains a binary value called DefaultConnectionSettings that stores all sorts of data about the user's proxy configuration.
What's the exact format of this data?
All I have been able to find out so far is what's in this forum post, which is by no means complete and seems to be wrong in some respects.
I have found this perhaps it helps you!
0. keep this value
1. "00" placeholder
2. "00" placeholder
3. "00" placeholder
4. "xx" increments if changed
5. "xx" increments if 4. is "FF"
6. "00" placeholder
7. "00" placeholder
8. "01"=proxy deaktivated; other value=proxy enabled
9. "00" placeholder
10. "00" placeholder
11. "00" placeholder
12. "xx" length of "proxyserver:port"
13. "00" placeholder
14. "00" placeholder
15. "00" placeholder
"proxyserver:port"
if 'Bypass proxy for local addresses':::
other stuff with unknown length
"<local>"
36 times "00"
if no 'Bypass proxy for local addresses':::
40 times "00"
Rather than read/write the Registry value directly, you should be using WinInet's InternetQueryOption() and InternetSetOption() functions instead.
With that said, have a look at these:
How to set 'automatic configuration script' for a dial-up connection programmatically?
http://www.visualbasicscript.com/fb.ashx?m=76412
Steven's answer is quite complete, just the many "placeholders" surprised me. My researches show, that most of them are in fact 32-bit integers stored in little-endian format (i.e. lowest byte first, i.e. 0xa1b2c3d4 ist stored as 0xd4 0xc3 0xb2 0xa1). This makes the magic DefaultConnectionSettings pretty simple:
4 bytes int: 0x46 or 0x3C (whatever that means)
4 bytes int: counter, increment upon every change
4 bytes int: proxy settings, i.e. a merge of these bits:
0x1 always present
0x2 enable manual proxy
0x4 enable autoconfig
0x8 enable autodetect
4 bytes int: length of proxyServer string (can be 0)
proxyServer string in ASCII (i.e. server:port)
4 bytes int: length of proxyOverrides string (can be 0)
proxyOverrides string in ASCII (domains separated by ;
use <local> for local override)
4 bytes int: length of autoconfigUrl string (can be 0)
autoconfigUrl string in ASCII
4 bytes int: 0x00 or 0x01 (whatever that means)
31 bytes: 0x00 (whatever that means)
Just want to expand upon Zain Ali's answer (as an answer, since I don't have enough reputation points to comment), and of Course, thank Zain for posting the information that they did as it helped me greatly when I was trying to figure the rest out.
Number 8 is a little more complicated than just showing that the proxy is disabled or not. It also sets two other checkboxes in the settings.
Setting number 8 to "01" unchecks the box to enable the proxy, and unchecks the box to "Automatically Detect Settings" and the box to use a script.
Setting number 8 to "0f" however enables everything.
To be clear, this 8th byte is basically setting flags. The least significant bit of the byte is always a "1" so far as i can tell. The second least significant bit is "1" if the manual proxy settings checkbox is checked. The 3rd least significant bit is a "1" if the box for using a script is checked and you provide an address for the script. The 4th least significant bit is to set the checkbox "Automatically Detect Settings" (basically, setting these bits to 1 checks the box, and 0 unchecks them)
I have gone for setting it to "03" which enables only the manual proxy
Also, "Other stuff with unknown length" doesn't seem to be correct as the length is known. Stuff after that is being referred to is the exception list for the proxy delimited by a semi-colon. The length of this list is the byte right after the "proxyserver:port". That, combined withe the 3 "00"s of padding accounts for the difference of 4 bytes that was mentioned as being different depending on what else you had.
0. keep this value
1. "00" placeholder
2. "00" placeholder
3. "00" placeholder
4. "xx" increments if changed
5. "xx" increments if 4. is "FF"
6. "00" placeholder
7. "00" placeholder
8. "03"=enable proxy, enable auto detect settings, auto script etc
9. "00" placeholder
10. "00" placeholder
11. "00" placeholder
12. "xx" length of "proxyserver:port"
13. "00" placeholder
14. "00" placeholder
15. "00" placeholder
"proxyserver:port"
"xx" length of proxy exception list
"00" placeholder
"00" placeholder
"00" placeholder
Proxy Exception list delimited by semi-colons (use "<local>" to exclude local addresses)
36 times "00"
I have spent quite some time trying to figure this all out so hopefully I haven't missed something.
I have made a batch script where you can give it the proxy server and port, along with your list of exceptions and it will automatically create the binary code and stick it into the registry where it needs to be (assuming that the 8th byte is "03").
It would be trivial to change the code to just print out the binary instead by just replacing the whole "reg add" line with "echo %data%".
Also note that the script i have provided below is changing the HKLM key as I was using the script to set a machine-wide proxy in conjunction with GPOs. Changing to HKCU instead should fix that.
That can be found here (if you are good with batch, feel free to make the script better as I am not greatly familiar with it and I think it will probably show in the code): https://gist.github.com/hallzy/b7dfba5f71c0251f1139f8c531cd7817
Steven Hall and Zain Ali's answers are really good, but they are not accurate.
I tried my best to get it as accurate as I can, but as you know with reverse engineering an API which has no documentation of, there could be mistakes:
1. 46
2. 00
3. 00
4. 00
5. Increments when you click the OK button on Lan Settings window
6. Inc overflow of 5
7. Inc overflow of 6
8. Inc overflow of 7
9. Toggle proxy* (This can have different values, read below)
10. 00
11. 00
12. 00
13. Length of server addresses and ports
14. Inc overflow of the length of server addresses and ports
15. Inc overflow of the length of server addresses and ports of above
16. Inc overflow of the length of server addresses and ports of above
17. Server addresses and ports (Omitted if length was 0)
??. Length of Exception addresses / Bypass local
??. Inc overflow of the length of Exception addresses / Bypass local
??. Inc overflow of the length of Exception addresses / Bypass local of above
??. Inc overflow of the length of Exception addresses / Bypass local of above
??. Exception addresses / Bypass local (Omitted if length was 0)
??. Length of Automatic Configuration Script Address and port
??. Inc overflow of the Length of Automatic Configuration Script Address and port
??. Inc overflow of the Length of Automatic Configuration Script Address and port of above
??. Inc overflow of the Length of Automatic Configuration Script Address and port of above
??. Automatic Configuration Script Address and port (Omitted if length was 0)
??. Mysterious 01: It only appears when: Automatically detect settings should be off and settings applied, now tick both Auto detect settings and auto config address (doesn't matter if it's empty). There's no way to get rid of this 01.
??. 31 00's at the end
Proxy toggle binary:
Depending on what the value is, it could toggle the Proxy server, the Automatically detect settings and the Use automatic configuration script tick boxes.
Disabled
1
5 autoconf
9 autodetect
4 autoconf
8 autodetect
0c (12) autoconf, autodetect
0d (13) autoconf, autodetect
Enabled
2
3
6 autoconf
7 autoconf
0a (10) autodetect
0b (11) autodetect
0e (14) autoconf, autodetect
0f (15) autoconf, autodetect
I went about figuring out all of this because I'm making a proxy manager AHK script on Github, once it's done I'll share the link here so you can use. And if I figure out what the rest of those 00's are, or any other finding, I'll update this answer.

Resources