I am in the process of interfacing with a BLE server and the first attempt is to view the response from Service 0x1818 - Characterstic 0x2A65 and to find out what Cycling Power Features are supported as per this link
https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.characteristic.cycling_power_feature.xml
What I get is this
[134,3,1,0]
I have read the documentation about 30 times and still cant figure out how to translate that into something useful.
How do I parse that response and map it to features to determine what is support by the BLE service/server?
The link you've sent says that the field 'Cycling Power Feature' is 32-bit, and is given LSB-first. So, your 4-bytes should be converted to binary like this (starting with MSB first):
'd0 → 'b0000_0000
'd1 → 'b0000_0001
'd3 → 'b0000_0011
'd134 → 'b1000_0110
Together you get (bits 31..0): 'b00000000_00000001_00000011_10000110
In the link, go over the meaning of each bit field, and see if it is True or False. For example:
bit 0, value: 0 → "Pedal Power Balance Supported" is False
bit 1, value: 1 → "Accumulated Torque Supported" is True
and so on.
Related
I want to convert temperature from Fahrenheit to Celsius. At run time it should ask the temperature in Fahrenheit and then show the the equivalent temperature in celsius.
Unlike other languages, RPG is built specifically for business programs. Thus it has no built in console IO like C or Java. Instead user interaction is traditionally via an object called a device file which mimics database IO. However, there is one op code that can be used to access the external message queue and can send a message and receive a reply. This op code is DSPLY. It is quite limited, you can only display a 52 character message, but will work for this purpose. A real solution where you want user IO would involve a display file. But to get something like what you are asking for in a way similar to other languages, you could write the following:
ctl-opt Option(*SrcStmt : *NoDebugIo: *NoUnref)
DftActGrp(*No) ActGrp(*New)
Main(temprature);
dcl-proc temprature;
dcl-s degreesC Char(15) Inz('');
dcl-s degreesF Char(15) Inz('');
dsply 'Enter temprature in degrees F' '*EXT' degreesF;
degreesC = %char(
(%dec(degreesF:15:0) - 32) * 5 / 9
);
dsply ('Temprature in degrees C is: ' + degreesC);
return;
end-proc;
The first dsply has three parameters, the message, the message queue, and a variable for the reply (which must be a character variable). The second dsply just has the message which can be an expression if it is enclosed in parenthesis. There is no reply, and it sends to the *EXT message queue by default for interactive jobs.
NOTE: DSPLY is really useful only for testing and debug, and has only limited utility for that. A program that will face users would use a display file or some other way to interact with the user such as through a browser using the CGIDEV2 library.
A good start is to look at the RPG Manual then start researching DDS. There is TONS of documentation out there. Just search for "iseries" then your topic.
Here is my problem, i received a body-in-white in the bdf format which, by reading the file, seems to have been created through Patran 2013 and i need to make some changes to the body-in-white. I use LMS Virtual Lab in order to make my modifications but unfortunately with Virtual Lab i can only import the bdf file and then after modifications i need to export the work into a new bdf file. One remarkable difference is the size of the bdf file shortening from 128MB to 92MB.
My next step is to compute the normal modal analysis through MD Nastran which works fine with the original bdf file giving me an OP2 result file. However with the modified bdf file it runs, gives an exit(0) (which means no abnormal exit) as does the original file and then when i try to look at the resulting OP2 file (in Nastran NX) it tells me it can't find any results (whereas in the original it does).
Any thoughts ?
Maybe you already found the answer but I would do the following:
First step would be to check f06 for Fatal Errors. If no errors found, you can check if Eigenvalues are listet in f06. If no clue by checking f06, I would check what LMS is doing with the model:
1.) input original file in LMS and output it as BDF
-> check if output-file contains same entities as input-file (number of grids,number of rbe2/3, number of quads,trias,hex, number of forces,spc)
2.) if 1.) shows you that input and output are the same, this means that LMS output-settings are ok
3.) if 1.) shows that there are some small differences, but size of the file is the same it means that some LMS settings are not suitable for your output
-> check LMS output Settings
-> start modal analysis
I hope it helps
I've been googling for quite a long time and I just can't find any information on how to get screen_number for every screen connected to computer. Here I found a list of macros and some of them (like for example ScreenOfDisplay(display, screen_number) ) use argument screen_number. However there is no such macro that could give me a list of those numbers (one for every connected screen). I know how to get number of default screen (DefaultScreen() ) and count of all screens ( ScreenCount() ) but what about other screens? I noticed that screen_number of default screen is 0, although I have only one screen connected to my computer so I can't really test what happens when there are more of them. I think that screen_number could be assigned in a very simple way which is screen_number=0 for first screen,screen_number=1 for second,screen_number=2 for third and so on but as I said... I can't test wheather it's true and even if I had multiple screens how could I be sure that it works like this for all computers .Please ,if anyone of you has more experience with X11 and knows all details about how it works,tell me if I am right.
The ScreenCount(dpy) macro and int XScreenCount(Display*) function both return the number of screens connected to the display. Valid screen numbers are 0 to ScreenCount(dpy)-1. Macros in Xlib.h confirm:
#define ScreenCount(dpy) (((_XPrivDisplay)dpy)->nscreens)
#define ScreenOfDisplay(dpy, scr) (&((_XPrivDisplay)dpy)->screens[scr])
Your source (2.2.1. Display Macros) provides enough information. Normally the default screen-number is 0, e.g., when connecting to the local host you could use :0.0 as indicated in the documentation for XOpenDisplay.
That is "normally". If you run VNC, normally that runs on a different display (the first 0 in the simple connection string shown).
But (reading the documentation), when an application calls XOpenDisplay, it asks for the given screen-number (which the X server may/may not honor):
screen_number
Specifies the screen to be used on that server. Multiple screens can be controlled by a single X server. The screen_number sets an internal variable that can be accessed by using the DefaultScreen() macro or the XDefaultScreen() function if you are using languages other than C (see "Display Macros").
The dev suggested to ask here to get more help.
This is what is happening, I bought a Raspberry Pi (second one, I know how to handle them, and I'm used to apt and ssh) and a Trendnet TFM561U modem, downloaded NOOBS, did the initial setup with an extra in the shape of Webmin. So far aside from Webmin, it's a vanilla Raspbian. I then downloaded JCblock ( http://sourceforge.net/projects/jcblock/ ) and following the instructions here http://weeklytechforum.com/2013/03/28/block-unwanted-calls-with-a-raspberry-pi/ I edited the files that needed editing and finally compiled. I found out what serial port the modem was using (same as the guide! cool) and finally proceeded to test it. That's where the trouble started.
The differences between me and the guide is that I'm in Italy, so the dev of JCblock made me edit the source with a few extra lines of code to talk to the modem... now it's a great time to point out that while I can edit code and recompile it, this is C and I absolutly have no clue about it, knowing just some basics from Pascal and a bit of Visual Basic, so in the end I'm editing the source blindly, just guessing where things need to go. Anyway the edits are to send the Country Code command: AT+GCI=59\r and Caller ID command: AT+VCID=1\r but we do not seem to be geting caller ID data from the modem.
What I'm expecting to see: I call with my cellphone (and that number is in the blacklist) the Raspberry doesn't make the phone ring, or in case of wrong configuration of the blacklist I get some output that will show a call not filtered.
What I get: the phone rings, the modem data light flashes, the program dosen't output anything.
Any help will be appreciated, thanks.
EDIT:
So, I went ahead and used NCID to see what would happen.
As it generates a cornucopia of data, I think it can be useful
Started: 10/27/2014 22:24:54
Server: ncidd (NCID) 1.0
API: 1.0 Feature Set 1 2 3 4
Command line: ncidd
-Dv3
Logfile: /var/log/ncidd.log
Processed config file: /etc/ncid/ncidd.conf
Verbose level: 3
Configured to send 'cidlog' to clients.
Configured to send 'cidinfo' to clients.
Helper tools:
/usr/bin/cidupdate
/usr/bin/ncidutil
Processed alias file: /etc/ncid/ncidd.alias
Alias Table:
Number of Entries: 1
Leading 1 from a call required in an alias definition
Calls in the blacklist file will be terminated
Processed blacklist file: /etc/ncid/ncidd.blacklist
Blacklist Table:
Number of Entries: 12
Calls in the whitelist file will not be terminated
Processed whitelist file: /etc/ncid/ncidd.whitelist
Whitelist Table:
Number of Entries: 0
CID logfile: /var/log/cidcall.log
CID logfile maximum size: 110000 bytes
Data logfile not present: /var/log/ciddata.log
Maximum number of clients/gateways: 25
Telephone Line Identifier: -
TTY port opened: /dev/ttyACM0
TTY port speed: 19200
TTY lock file: /var/lock/LCK..ttyACM0
TTY port control signals enabled
CallerID from AT Modem and optional gateways
Handles modem calls without Caller ID
Sent Modem 20 of 20 characters:
AT Z S0=0 E1 V1 Q0
Modem response: 26 characters in 1 read:
AT Z S0=0 E1 V1 Q0
OK
Try 1 to init modem: return = 0.
Modem initialized.
Sent Modem 6 of 6 characters:
ATI3
Modem response: 39 characters in 1 read:
ATI3
CX93001-EIS_V0.2002-V92
OK
Sent Modem 9 of 9 characters:
AT+GCI?
Modem response: 27 characters in 1 read:
AT+GCI?
+GCI: 59
OK
Sent Modem 13 of 13 characters:
AT+FCLASS=?
Modem response: 32 characters in 1 read:
AT+FCLASS=?
0,1,1.0,8
OK
Sent Modem 11 of 11 characters:
AT+VCID=1
Modem response: 17 characters in 1 read:
AT+VCID=1
OK
Modem set for CallerID.
Hangup option set to hangup on a blacklisted call
Modem used for CID and to terminate calls
Network Port: 3333
Debug Mode
Not using PID file, there was no '-P' option.
Modem is fd 4
NCID connection socket is sd 5 pos 1
RING
CIDINFO: *LINE*POTS*RING*1*TIME*22:25:21*
CIDINFO: *LINE*POTS*RING*0*TIME*22:25:33*
What I can tell from this, is that it should be properly set up to hang up for a blacklisted number (my cellphone, for testing purposes) and that no caller id gets to the software. About that, it's important to point out how we have a mess of different phones (make, model, cordless, wired...) at home, and all of them do show 1 missed call from me. So at least I can confirm that the caller id is being sent.
I looked on Trendnet TFM561U description page and Amazon for this modem and didn't see "caller ID" in the description.
Your modem looks like it has Caller ID because its response to the activate caller ID command is "OK":
AT+VCID=1
OK
But looking at
Testing Modem Caller ID Support with HyperTerminal (or Putty) page
However, if, in step 8), the modem responded with "OK", then you probably have the correct string. In this case, either your phone line does not have caller id enabled (this can be tested with a hardware caller id device), or the modem does not support caller id. The latter is possible even if, in step 8), the modem responded with "OK", since many modems use the same firmware regardless of whether the modem contains the appropriate caller id hardware. In other words, many modems don't know whether they have caller id support!
I would say return your modem and get one that has "caller ID" in the description.
I'm working on supporting of the TCL (thermal control protocol, stupid name, its a printer protocol of futurelogic) but i cannot find resources about this protocol, how it is, how it works, nothing, on theirs site i only found this mention http://www.futurelogic-inc.com/trademarks.aspx
any one had worked with it? does any one knows where can i find the data sheet?
The protocol is documented on their website http://www.futurelogic-inc.com/support/downloads/
If you are targetting the PSA66ST model it supports a number of protocols TCL, which is quite nice for delivering templated tickets and, line printing using the Epson ESC/P protocol.
This is all explained in the protocol document.
Oops, these links are incorrect and only correspond to marketing brochures. You will need to contact Futurelogic for the protocol documents. Probably also need to sign an NDA. Anyway, the information may guide you some more.
From what I can gather, it seems the FutureLogic thermal printers do not support general printing, but only printing using predefined templates stored in the printer's firmware. The basic command structure is a caret ^ followed by a one or two character command code, with arguments delimited using a pipe |, and the command ended with another caret ^. I've been able to reverse-engineer a few commands:
^S^ - Printer status
^Se^ - Extended printer status
^C|x|^ - Clear. Known arguments:
a - all
j - jam
^P|x|y0|...|yn|^ - Print fields y0 through yn using template x.
Data areas are defined in the firmware using a similar command format, command ^D|x|y0|...|yn|^, and templates are defined from data areas using command ^T|z|x0|...|xn|^.