Re: [Gambas-user] Serial I/O with byte data
Following should work for you: Public Sub XXX_Read() Dim iLen As Integer Dim aData As Byte[] iLen = Lof(Last) aData = New Byte[] aData.Resize(iLen) Try aData.Read(Last, 0, iLen) End You need to get the length (lof) first, then resize array ... only then you can read it. 2017-05-14 21:56 GMT+02:00 Tobias Boege : > On Sun, 14 May 2017, alexchernoff wrote: > > Good day all, > > > > Anyone know how to read data received on serial port into an array of > bytes > > instead of string? > > > > I think that's not possible. > > > String gets unreadable binary characters, so how can I > > put them into byte[] or so? > > > > This shouldn't be a problem. Gambas Strings are not null-terminated and can > contain any sequence of bytes, which includes non-printable characters > (which > I think is what you meant by "unreadable" characters). > > If you insist on a Byte[], read it into a String and use > Byte[].FromString(), > but there is no way to go around the String, AFAICT (and that is because > there is no need to, as Strings can handle binary data just fine). > > Regards, > Tobi > > -- > "There's an old saying: Don't change anything... ever!" -- Mr. Monk > > > -- > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > ___ > Gambas-user mailing list > Gambas-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user > -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
[Gambas-user] Re: Keyboard locked -- insisting one more time
Hi, I'm having exactly the same problem here in Xubuntu 17.04 with Gambas 3.9.1 and 3.9.2(PPA). My system information: [System] Gambas=3.9.2 OperatingSystem=Linux Kernel=4.10.0-20-generic Architecture=x86_64 Distribution=Ubuntu 17.04 Desktop=XFCE Theme=Gtk Language=pt_BR.UTF-8 Memory=3829M [Libraries] Cairo=libcairo.so.2.11400.8 Curl=libcurl.so.4.4.0 DBus=libdbus-1.so.3.14.7 GStreamer=libgstreamer-1.0.so.0.1004.0 GTK+2=libgtk-x11-2.0.so.0.2400.31 GTK+3=libgtk-3.so.0.2200.11 OpenGL=libGL.so.1.2.0 Poppler=libpoppler.so.64.0.0 QT4=libQtCore.so.4.8.7 QT5=libQt5Core.so.5.7.1 SDL=libSDL-1.2.so.0.11.4 SQLite=libsqlite3.so.0.8.6 [Environment] CLUTTER_BACKEND=x11 DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus DEFAULTS_PATH=/usr/share/gconf/xubuntu.default.path DERBY_HOME=/usr/lib/jvm/java-8-oracle/db DESKTOP_SESSION=xubuntu DISPLAY=:0.0 GB_GUI=gb.qt4 GDMSESSION=xubuntu GLADE_CATALOG_PATH=: GLADE_MODULE_PATH=: GLADE_PIXMAP_PATH=: GTK_MODULES=gail:atk-bridge GTK_OVERLAY_SCROLLING=0 HOME= J2REDIR=/usr/lib/jvm/java-8-oracle/jre J2SDKDIR=/usr/lib/jvm/java-8-oracle JAVA_HOME=/usr/lib/jvm/java-8-oracle JOURNAL_STREAM=8:23426 LANG=pt_BR.UTF-8 LANGUAGE=pt_BR:pt:en LOGNAME= MANDATORY_PATH=/usr/share/gconf/xubuntu.mandatory.path PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin PWD= QT_ACCESSIBILITY=1 QT_LINUX_ACCESSIBILITY_ALWAYS_ON=1 QT_QPA_PLATFORMTHEME=gtk2 SESSION_MANAGER=local/:@/tmp/.ICE-unix/1227,unix/:/tmp/.ICE-unix/1227 SHELL=/bin/bash SHLVL=0 SSH_AGENT_PID=1209 SSH_AUTH_SOCK=/run/user/1000/keyring/ssh TZ=:/etc/localtime USER= USERNAME= WINDOWPATH=1 XAUTHORITY=/run/user/1000/gdm/Xauthority XDG_CONFIG_DIRS=/etc/xdg/xdg-xubuntu:/etc/xdg:/etc/xdg XDG_CURRENT_DESKTOP=XFCE XDG_DATA_DIRS=/usr/share/xubuntu:/usr/share/xfce4:/.local/share/flatpak/exports/share/:/var/lib/flatpak/exports/share/:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop:/usr/share XDG_MENU_PREFIX=xfce- XDG_RUNTIME_DIR=/run/user/1000 XDG_SEAT=seat0 XDG_SESSION_DESKTOP=xubuntu XDG_SESSION_ID=1 XDG_SESSION_TYPE=x11 XDG_VTNR=1 _JAVA_OPTIONS=-Dawt.useSystemAAFontSettings=on -Dswing.aatext=true -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel --- Gláucio de Araujo Mail : glaucio.de.ara...@gmail.com TIM : (11) 95900-7801 (WhatsApp / Telegram) > Thank you, Tobi for your patience explaining this whole thing. > Your comments make sense. No, as to the keyboard issue, > what I can not figure out boils down to two things: First, I have not > changed anything. At least that I know of. > Second, why I only see the problem with the gambas IDE? Everything else is > working fine. > > I also have tried this: > a) installed Linux Mint 18.1 in a virtual box > b) mounted the original directories in the virtual box > c) installed gambas in the virtual machine > d) edited the original files in the virtual environment -- no problems > whatsoever. > > The keyboard is the same. The hardware is the same. The operating system is > the same. > Nevertheless, the IDE behavior is different. > > It must have something to do with the keyboard driver, but what? > > I still can't see why this would only affect Gambas and nothing else. Not > even applications developed with gambas. > > Anyway, I am glad you and others have tried so hard to help me. > > - fernando > > > > -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Serial I/O with byte data
On Sun, 14 May 2017, alexchernoff wrote: > Good day all, > > Anyone know how to read data received on serial port into an array of bytes > instead of string? > I think that's not possible. > String gets unreadable binary characters, so how can I > put them into byte[] or so? > This shouldn't be a problem. Gambas Strings are not null-terminated and can contain any sequence of bytes, which includes non-printable characters (which I think is what you meant by "unreadable" characters). If you insist on a Byte[], read it into a String and use Byte[].FromString(), but there is no way to go around the String, AFAICT (and that is because there is no need to, as Strings can handle binary data just fine). Regards, Tobi -- "There's an old saying: Don't change anything... ever!" -- Mr. Monk -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Serial I/O with byte data
Good day all, Anyone know how to read data received on serial port into an array of bytes instead of string? String gets unreadable binary characters, so how can I put them into byte[] or so? Thanks! -- View this message in context: http://gambas.8142.n7.nabble.com/Serial-I-O-with-byte-data-tp58933p58977.html Sent from the gambas-user mailing list archive at Nabble.com. -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] How to use gb.map ".AddPolyLine( )" method ?
Hi Fabien, the gb.map works very well. Thank you for this. But I have questions about AddPolyLine: 1) The AddPolyLine() always draws the outline of polygon. Is it possible to have only lines with an 'open end'? I tried to set the last Mappoint to the same values as the next-to-last Mappoint. That does'nt help. 2) Can I manipulate the thickness of the line? Thank you in advance. Ingo -- View this message in context: http://gambas.8142.n7.nabble.com/How-to-use-gb-map-AddPolyLine-method-tp57682p58976.html Sent from the gambas-user mailing list archive at Nabble.com. -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user