4. @mohsenoid
In a single Text Message: 160 Char
W14(3)|Type*(1)|#ofGoals(128)|UserPoint(4)|Qualified(16)|Error**(1)|Checksum(1)
*Type: RESULT("R") / PREDICT("P") / STATES("S")
** Error: User last predict message error call back
6. @mohsenoid
* MTU: Maximum Transmission Unit
* Package/Sec: 7.5~1.25 milliseconds
https://punchthrough.com/blog/posts/maximizing-ble-throughput-on-ios-and-android
BLE Data Throughput
Best case MTU Worst case MTU
512 Bytes 20 Bytes!!!
7. @mohsenoid
Google developed Protocol Buffers for internal usage and
also provided a code generator for multiple languages.
https://github.com/google/protobuf
C++ / Java / Python / Objective-C / C# / JavaNano / JavaScript / Ruby / Go / PHP / Dart
8. @mohsenoid
● Protocol Buffers is a method of serializing structured data
● Useful in developing programs to communicate with each
other and also good for storing data
● interface description language: describes the structure of
some data
● a program that generates source code from description
for generating or parsing a stream of bytes that
represents the structured data
What is Protocol Buffers?
12. @mohsenoid
Java module build.gradle
apply plugin: 'com.google.protobuf'
…
// lite version is recommended for Android apps
implementation 'com.google.protobuf:protobuf-lite:3.0.0'
...
13. @mohsenoid
Protobuf plugin settings
protobuf {
protoc { // setting proto compiler
artifact = 'com.google.protobuf:protoc:3.0.0'
}
plugins { // ask proto plugin to use java lite code generator
javalite {
artifact = 'com.google.protobuf:protoc-gen-javalite:3.0.0'
}
}
14. @mohsenoid
Protobuf plugin settings
generateProtoTasks {
all().each { task ->
task.builtins {
remove java // because of using javalite we should remove java outputs
}
task.plugins {
javalite {} // and use javalite
}
}
24. @mohsenoid
Protocol buffer is a useful way of
serializing and deserializing data
(also obfuscating!!!)
perfectly optimized in case of data transmission size and also avoiding all manual data typing