<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="pl-pl">
<link rel="self" type="application/atom+xml" href="https://forum.atnel.pl/feed.php?f=63&amp;t=19930&amp;mode" />

<title>ATNEL tech-forum</title>
<link href="https://forum.atnel.pl/index.php" />
<updated>2018-01-07T17:01:39+01:00</updated>

<author><name><![CDATA[ATNEL tech-forum]]></name></author>
<id>https://forum.atnel.pl/feed.php?f=63&amp;t=19930&amp;mode</id>
<entry>
<author><name><![CDATA[spairo]]></name></author>
<updated>2018-01-07T17:01:39+01:00</updated>
<published>2018-01-07T17:01:39+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=19930&amp;p=201637#p201637</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=19930&amp;p=201637#p201637"/>
<title type="html"><![CDATA[Re: [B4A][BLE2]Program wysyłający ciąg znaków do HM-10]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=19930&amp;p=201637#p201637"><![CDATA[
- w tych liniach jes opis bledu<br />[syntax=c]java.lang.IllegalArgumentException: Invalid UUID string:<br />   at java.util.UUID.fromString(UUID.java:194)<br />   at anywheresoftware.b4a.objects.BleManager2.Scan2(BleManager2.java:138)<br />   at b4a.example.starter._ble_statechanged(starter.java:183)[/syntax]<br />- czyli brakuje stringa UUID.<br />- dokładnie program ci pokaze numer linii jak uruchomisz to w trybie debug.<br />- na marginesie konwersja VB to B4A nigdy mi nic nie przyniosła.<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=15078">spairo</a> — 7 sty 2018, o 17:01</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Bertek]]></name></author>
<updated>2018-01-07T13:29:43+01:00</updated>
<published>2018-01-07T13:29:43+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=19930&amp;p=201628#p201628</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=19930&amp;p=201628#p201628"/>
<title type="html"><![CDATA[[B4A][BLE2]Program wysyłający ciąg znaków do HM-10]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=19930&amp;p=201628#p201628"><![CDATA[
Witam !<br />Na wstępie zaznaczę, iż jestem początkującym programistą a z Javą a tym bardziej ze środowiskiem Android nie miałem kompletnie styczności.<br /><br />Założenie programu jest bardzo proste w początkowej fazie. Program ma: Wyszukać urządzenie BLE &gt; Wybrać z listy odpowiednie &gt; Połączyć się z nim &gt; Wysłać do niego jakikolwiek znak, ciąg znaków, tekst.<br /><br />Buszowałem wnikliwie oficjalne forum Basic 4 Android, znalazłem przykłady zastosowania biblioteki BLE2, która właśnie do tego została stworzona. Mój kod w tym momencie zakłada samo skanowanie, gdyż już na tym poległem. Wkleję poniżej kod i zwrócony błąd.<br /><br />[syntax=vb]#Region  Service Attributes <br />#StartAtBoot: False<br />#ExcludeFromLibrary: True<br />#End Region<br /><br />Sub Process_Globals<br />'These global variables will be declared once when the application starts.<br />'These variables can be accessed from all modules.<br /><br />Public ble As BleManager2<br />Private serviceID, charID As String<br />Private tablica As String<br />Private connected As Boolean<br />Dim Stan As String<br />End Sub<br /><br />Sub Service_Create<br />'This is the program entry point.<br />'This is a good place to load resources that are not specific to a single activity.<br />ble.Initialize(&quot;ble&quot;)<br />'serviceId = UUID(&quot;ffe0&quot;)<br />'charID = UUID(&quot;ffe1&quot;)<br />End Sub<br /><br />Sub ble_StateChanged (Stn As Int)<br />Select Stn<br />Case ble.STATE_POWERED_OFF<br />Stan = &quot;Wyłączony Bluetooth&quot;<br />Case ble.STATE_POWERED_ON<br />Stan = &quot;Bluetooth Włączony&quot;<br />Case ble.STATE_UNSUPPORTED<br />Stan = &quot;Bluetooth nie wspiera funkcji&quot;<br />End Select<br />CallSub(&quot;Main&quot;, &quot;BleStateChanged&quot;)<br />If Stn = ble.STATE_POWERED_ON Then<br />ble.Scan2(Array (tablica), False)<br />End If<br />'CallSub(&quot;Main&quot;, &quot;Lista&quot;)<br /><br />End Sub<br /><br />Sub ble_Znaleziono(Name As String, Id As String, AdvertisingData As Map, RSSI As Double)<br />Log($&quot;Urządzenie: ${Name}&quot;$)<br />ble.Connect2(Id, False)<br />End Sub<br /><br />Sub Service_Start (StartingIntent As Intent)<br /><br />End Sub<br /><br />Sub Service_TaskRemoved<br />'This event will be raised when the user removes the app from the recent apps list.<br />End Sub<br /><br />'Return true to allow the OS default exceptions handler to handle the uncaught exception.<br />Sub Application_Error (Error As Exception, StackTrace As String) As Boolean<br />Return True<br />End Sub<br /><br />Sub Service_Destroy<br /><br />End Sub[/syntax]<br /><br />Zwrócony błąd:<br /><div class="codetitle"><b>Code:</b></div><div class="codecontent">Logger połączony z:  Xiaomi Redmi 3<br />--------- beginning of main<br />*** Service (starter) Create ***<br />** Service (starter) Start **<br />** Activity (main) Create, isFirst = true **<br />** Activity (main) Resume **<br />Error occurred on line: 36 (Starter)<br />java.lang.IllegalArgumentException: Invalid UUID string: <br />   at java.util.UUID.fromString(UUID.java:194)<br />   at anywheresoftware.b4a.objects.BleManager2.Scan2(BleManager2.java:138)<br />   at b4a.example.starter._ble_statechanged(starter.java:183)<br />   at java.lang.reflect.Method.invoke(Native Method)<br />   at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:710)<br />   at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:339)<br />   at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:249)<br />   at java.lang.reflect.Method.invoke(Native Method)<br />   at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:139)<br />   at anywheresoftware.b4a.BA.raiseEvent(BA.java:166)<br />   at anywheresoftware.b4a.objects.BleManager2$1$1.run(BleManager2.java:83)<br />   at android.os.Handler.handleCallback(Handler.java:751)<br />   at android.os.Handler.dispatchMessage(Handler.java:95)<br />   at android.os.Looper.loop(Looper.java:154)<br />   at android.app.ActivityThread.main(ActivityThread.java:6186)<br />   at java.lang.reflect.Method.invoke(Native Method)<br />   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)<br />   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)<br /></div><br /><br />Zdaję sobie sprawę że błąd dotyczy typu zmiennej - Wczytanie wartości string do Tablicy, jednak w przykładach które można znaleźć tutaj <a href="https://pastebin.com/5FDMz5wz"  class="postlink">PASTEBIN</a> autor używa tej funkcji w dokładnie taki sam sposób, a aplikacja nie zwraca błędu.<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=18742">Bertek</a> — 7 sty 2018, o 13:29</p><hr />
]]></content>
</entry>
</feed>