Extract information from BLE device - ionic-framework

currently I'm working on a BLE project based on Ionic (#ionic-native/ble). I've asked couple of questions before and finally managed to write an entry-level app. But now it's come to another problem, which is that I don't know how to work with the data provided by the device.
Okay so first, my code is based on this guy's work: (Thank you, Don, btw)https://github.com/don/ionic-ble-examples/tree/master/connect
And here is the demo:
As you can see, I have a fully functional estimote beacon and I'm required to get the minor, major, ID from that beacon. The problem is that in the second image I can't see any attributes that are related to the three above and furthermore, I don't know what to do with the bunch of information I get after connecting. So my question is, what to do after connecting to a BLE device, and, can anyone suggest me some good, for-dummies documentation that I can read to understand the meaning of those creepy strings of data? All the ionic-ble-tutorials that I found are outdated and documents about BLE are extremely hard to understand.

Characteristics are what you want to interact with whenever you are trying to read, write or subscribe for data. Look at all the characteristics and their properties. If their properties have 'read', read those properties and see what kinda information you get. I think the Don Coleman plugin responds back with an ArrayBuffer. To convert an ArrayBuffer into a readable array of bytes, do
[].slice.call(new Uint8Array(value))
See if the documentation of the device matches the response you got back from the read. Are you expecting certain kind of values? If you don't know what to look for, it would be very hard to tell what is the relevant information looking at the array of bytes.

Related

Flutter : What is the maximum weight of global variables?

Good morning all,
I'm looking to know how variables are stored in a flutter application. I don't really know the world of mobile, so I'm a little lost. I'm on a project in which I have to store information when launching the application, which I retrieve via an API (they are then deleted when the user closes the application). Currently, the amount of data is reasonable, but I would like to know how much data I can temporarily store in my application (10kb? 10mo?), what are the risks with this way of doing things, does it have slow down the app...
I couldn't find anything on the flutter doc (https://docs.flutter.dev/perf/memory - At the time of writing this message, the line returns to an empty page with the letters TBD). I couldn't find any articles explaining the specifics of memory, performance related variable storage, related to flutter.
Thanks for your help !
The Dart compiler used by Flutter is actually very good at optimizing code, so variables have almost zero overhead.
Having said that I must add that using global variables is not a good way of storing data in any kind of software. I suppose you select a suitable state management technique to handle your data.
Regarding the amount of data, I don't think 10mo will be too much on a modern mobile device, but as always, ymmv.

how do we know if what customer says meet the intent?

I'm new to Dialogflow and I want to learn something from it. Currently I'm stuck with 2 problems. First is how do we know if what customer says meet the intent?:
According to google's tutorial, it puts in training phrases:like the screen shot. In my case, I don't know how to trigger the intent. I tried My favorite color is Tony. It would ask as what I expected:What's your favorite color. But if I just say, Tony, It would goes to the fallback case. I'm confused about how would the intent be trigger. Is it by entity? or something else?
In addition, I currently wrote a coupon lines of code on linux(which could convert to other language as well) to turn on and off a board's led light(my friend helped me). However, since I'm new to dialogflow and I want to do things like: If I talk to google, it would turn it on/off. I'm wondering how should I do it. Could I get some hint? I never learned api before and I could certainly learn it on my own. I just wanna need some help.
p.s: I learned one year C++, so I'm not familiar with javascript, if completing this project requires javascript, I would certainly do that. Just need some hint pls.
Thanks!!
First, you should know that you need not learn any other language if you are already good at something & that is cause Dialogflow offers you SDKs for that. You can check it out over here: https://dialogflow.com/docs/sdks.
Now coming to your query, when user enters anything, that query comes to dialogflow & then it tries to find matches between different training phrases that you have entered in your intent. If there's a match found, having scored more than threshold, it sends us the response defined for that intent. You can even define custom entities, such as for colors, it would just help dialogflow to find more accurate intent. Following snaps should help you understand a situation better:
1. Intent-1
2. Intent-2
3. Custom entity
4. Output
Hope this answers your query.

How to set up an iOS app to have perpetual memory?

I am asking what code to use to save user data in the app so that it is perpetual, even after the app is closed and reopened. I watched a few videos but my code isn't working.
I'm not interested in fixing code, I want to understand the process so I can reapply. Can anyone help me to understand how to do this and explain it in a way that makes sense for long term app development.
It will differ by application, depending on how much data and how it's organized.
If it's simple stuff, look at NSUserDefaults. If it's complicated and represented as objects, look at Core Data. If there's a lot of it and you see it as table rows rather than objects, you can use the sqlite3 database directly. If it has to be shared with other users or by other apps, start thinking about an external server or "the cloud".
There's no single right answer but those options should get you thinking about requirements.

How to get data from an SQL database in Objective-C?

I know this has probably been answered before, but I cannot find much information on this subject. The only information I have found is that I need to use an SQL database, thus leading me to ask this question.
I am making an iPhone app that needs to store four integers, six floats, and two NSStrings online somehow (SQL sounds like the answer), and I need to be able to get the data as well. Is there any documentation on the subject that might help? If not, how can I get the data?
The next thing I need to know is how I can set it up for hundreds of users to store and access all of the variables. By this I mean that each user's four integers, six floats, and two NSStrings will be totally different, and I cannot figure out how to set it up in a way that works. Is there any documentation for this?
Thanks in advance!
One way
OData provides an SDK that allows you to consume/produce an OData service from a SQL database (or really any other data source) with objective-C on devices such as an iPhone.
The SDK can be found here:
http://www.odata.org/developers/odata-sdk
There is also a developed client on codeplex:
http://odataobjc.codeplex.com/
Keep in mind you'll have to develop both the provider (data source) as well as consumer (your app).
You can get a primer on the basics of building a provider here (using VS as an example, but its roughly the same no matter your platform).
http://msdn.microsoft.com/en-us/data/gg601462
A side benefit of OData is that once you have a producer... then any device can feasibly use it. Android, Windows Phone, PHP, Javascript, the list goes on. (I don't know if you care, but you might)

real-time synchronization between two devices over a wireless signal

i have never done embedded (i dont know if thats what you call this) programming and know nothing about it. my question:
is it possible to have two devices sharing a wireless connection (no internet, just between themselves, perhaps bluetooth, but i dont know what ever is best) ?
is it possible to have one editing a file and the other person editing the same file and they can see changes in real time? sort of like google docs?
does this exist already?
what can i do to get started regarding this kind of programming?
to clarify:
i want two people with iphones or any other hand held device, to be able to edit a text file at the same time and see each other's changes in real-time. how do i do this?
There are a bunch of slightly strange assumptions hidden in your questions. I'll try to unpick them as best as I can.
You've used "embedded" programming in a strange way. Usually this would suggest some kind of low-power devices used in settings without direct user interaction in some sense (e.g. factory controllers, refrigerator controllers, sensor nodes), performing a very specific task, but you've gone on to talk bout people editing files. What exactly would be the user interface here? What would make this embedded programming? I think you need to describe an application before any advice can be offered.
If you actually mean embedded devices, then whether they can connect wirelessly to one another is going to depend on the nature of the device. Similarly, the protocol/technologies involved will depend on the device. Embedded programming tends to be very much device-specific. There certainly exist wireless sensor nodes, for example, that incorporate small radio transceivers for serial comms.
Google docs already exists. Without a clearer problem description it's difficult to say whether what you want exists already or not.
I think you should really figure out exactly what kind of programming it is that you want to do before we can offer points as to how to best get started with it. Maybe look up a definition of "embedded programming" and see how this relates to your goals such that you can reformulate your questions a little more clearly.
I'm not sure how "real time" would fit into this scenario either. This term is used and abused in many ways. Things are only ever real-time with respect to some constraint, usually defined in terms of the application.
(Note: This might have been more appropriate as a comment, but I felt there was too much to respond to in order to sum up within character limits, and I hope correcting some of the confusion constitutes something of an answer, given the limitations of the question).
Two devices can share a connection like this. It's done all the time. There are many many protocols for this. Weather or not it is wired or wireless or uses the Internet doesn't really matter for 90% of this.
This is sort of doable, but not really. You really have a race condition when two people are editing at the same time. This is generally avoidable by locking out small parts of the document at from all but one editor at a time (like only one person being able to edit one cell of a spreadsheet at a time), but this has problems too (like of the one active editor is taking way too long -- this is a problem seen in many source version control systems too).
1 already exists in many many forms. 2 sort of exists in many forms, but the problems I mentioned are impossible to completely overcome.
The way you asked this question leads me to believe that you are very far from being able to do this. In addition, you didn't tell us anything about what you do know how to do. Can you write a simple text editor for an iPhone (or anything else)? Simple text editors from scratch that aren't crappy aren't easy to write.
What you need to do, if you really want to do this, is to come up with a protocol for the two (or more) devices to talk to each other in. To do this it is probably best if you figure out what type of communication is available between the devices and which of those you will use and what features it does not provide that you will need on top.
You could try to send patches of the file (or something similar) between the two devices as edits are made, but then you'll have to decide what to do in the event of a collision (edits near the same place).
Alternately you could have the two devices exchange permission to make edits (like in token ring networks).
You still have a problem if the two devices lose communication with each other during the editing of the file, though. With the token ring type setup you stand the possibility of losing the token and neither being able to automatically recover easily. Whatever you do you end up with the problem of the two ending up with different ideas of the file's contents.
"iphones or any other hand held device" - the technology stack to do that doesn't exist today. You have to co-ordinate between multiple languages and systems. (Okay, maybe you want to write that software, but it's a huge undertaking).
Your best bet would be to create a web page that all of the mobile browsers can work on and save a text file from.
Of course it's possible. Bluetooth does this. Wi-Fi does this if you join an ad-hoc network.
Of course it's possible. Just run the Google Docs server on one of the devices.
It might.
Way too vague.