Skip to content

Commit a24ebee

Browse files
author
Ojima Abraham
committed
Finished linking and implementation
1 parent c4eec3f commit a24ebee

File tree

11 files changed

+1336
-60
lines changed

11 files changed

+1336
-60
lines changed

example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
/* Begin PBXBuildFile section */
1010
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
1111
1BA53A9FBB5BB07EF5276720 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 048246CF5CFAD0F038980A03 /* Pods_Runner.framework */; };
12-
274306C42C595BEC00284D78 /* libresolv.9.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 274306C32C595BDB00284D78 /* libresolv.9.tbd */; };
13-
274306C52C595BF600284D78 /* libresolv.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 274306C22C595BDB00284D78 /* libresolv.tbd */; };
12+
2794BDEF2C5970E900768D6D /* libresolv.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 274306C22C595BDB00284D78 /* libresolv.tbd */; };
1413
331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; };
1514
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
1615
3DBD450E1C440EEA45A64416 /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E62D416DBB85CFE6BDC76CE /* Pods_RunnerTests.framework */; };
@@ -76,9 +75,8 @@
7675
isa = PBXFrameworksBuildPhase;
7776
buildActionMask = 2147483647;
7877
files = (
79-
274306C42C595BEC00284D78 /* libresolv.9.tbd in Frameworks */,
78+
2794BDEF2C5970E900768D6D /* libresolv.tbd in Frameworks */,
8079
1BA53A9FBB5BB07EF5276720 /* Pods_Runner.framework in Frameworks */,
81-
274306C52C595BF600284D78 /* libresolv.tbd in Frameworks */,
8280
);
8381
runOnlyForDeploymentPostprocessing = 0;
8482
};

example/lib/main.dart

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,30 @@ class MyApp extends StatefulWidget {
1717
class _MyAppState extends State<MyApp> {
1818
final _formKey = GlobalKey<FormState>();
1919
final textEditingController = TextEditingController();
20-
late Map<dynamic, dynamic> result;
20+
late String result;
2121
late Uint8List byteArr;
2222

2323
bool showData = false;
2424

2525
@override
2626
void initState() {
2727
super.initState();
28-
final byteArrTemp = Uint8List.fromList(utf8.encode(
29-
"!PDGY,130567,6,200,255,25631.18,RgPczwYAQnYeAB4AAAADAAAAAABQbiMA"));
30-
result = flutter_nmea.processData(byteArrTemp);
31-
}
3228

33-
//!PDGY,130567,6,200,255,25631.18,RgPczwYAQnYeAB4AAAADAAAAAABQbiMA
29+
// Test data for
30+
List<String> dataPoints = [
31+
'{"0EEFF-00": "/+4AAGRD/j/yAKlmAAAAALAiDwAAAAAACAD/AAAABgB9gCQiAIIywA=="}',
32+
'{"1FB12-16": "EvsBAGRD/j/BAKlmAAAAAIk5CgAAAAAAIwD/ABYABgAYQMfxFSVHUk1EQEBFAP///////xgBWgAoALQAAAAAAAPh/w=="}',
33+
'{"0EEFF-09": "/+4AAGRD/j854qdmAAAAAKYuBwAAAAAACAD/AAkABgCP87AcAILcwA=="}',
34+
'{"1F014-1C": "FPABALg+gD9dtqdmAAAAALDoBQAAAAAAhgD/ABwABgA0CBMZR1BTTUFQIDg2MjIA//////////////////////////8zMy40MAD//////////////////////////////////zEuMAD/////////////////////////////////////MzQ1MDQ0OTU5NAD///////////////////////////8CAg=="}',
35+
];
36+
37+
for (var data in dataPoints) {
38+
List<String> key = jsonDecode(data).keys.toList();
39+
print('Processing data: $key');
40+
byteArr = Uint8List.fromList(utf8.encode(data));
41+
result = flutter_nmea.processData(byteArr);
42+
}
43+
}
3444

3545
void processDataCall() {
3646
if (!textEditingController.text.isEmpty) {
@@ -66,10 +76,10 @@ class _MyAppState extends State<MyApp> {
6676
? 'Please enter raw data'
6777
: null,
6878
controller: textEditingController,
69-
decoration: InputDecoration(
79+
decoration: const InputDecoration(
7080
floatingLabelBehavior:
7181
FloatingLabelBehavior.always,
72-
label: const Text('Enter data'),
82+
label: Text('Enter data'),
7383
border: OutlineInputBorder(
7484
borderRadius:
7585
BorderRadius.all(Radius.zero)),
@@ -101,6 +111,7 @@ class _MyAppState extends State<MyApp> {
101111
style: textStyle,
102112
textAlign: TextAlign.center,
103113
),
114+
104115
],
105116
),
106117
],

ios/libsum.xcframework/Info.plist

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,34 +10,34 @@
1010
<key>HeadersPath</key>
1111
<string>Headers</string>
1212
<key>LibraryIdentifier</key>
13-
<string>ios-arm64_x86_64-simulator</string>
13+
<string>ios-arm64</string>
1414
<key>LibraryPath</key>
1515
<string>libsum.a</string>
1616
<key>SupportedArchitectures</key>
1717
<array>
1818
<string>arm64</string>
19-
<string>x86_64</string>
2019
</array>
2120
<key>SupportedPlatform</key>
2221
<string>ios</string>
23-
<key>SupportedPlatformVariant</key>
24-
<string>simulator</string>
2522
</dict>
2623
<dict>
2724
<key>BinaryPath</key>
2825
<string>libsum.a</string>
2926
<key>HeadersPath</key>
3027
<string>Headers</string>
3128
<key>LibraryIdentifier</key>
32-
<string>ios-arm64</string>
29+
<string>ios-arm64_x86_64-simulator</string>
3330
<key>LibraryPath</key>
3431
<string>libsum.a</string>
3532
<key>SupportedArchitectures</key>
3633
<array>
3734
<string>arm64</string>
35+
<string>x86_64</string>
3836
</array>
3937
<key>SupportedPlatform</key>
4038
<string>ios</string>
39+
<key>SupportedPlatformVariant</key>
40+
<string>simulator</string>
4141
</dict>
4242
</array>
4343
<key>CFBundlePackageType</key>

ios/libsum.xcframework/ios-arm64/Headers

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ extern "C" {
7575
#endif
7676

7777
extern void enforce_binding();
78+
extern void res_9_nclose();
79+
extern void res_9_ninit();
80+
extern void res_9_nsearch();
7881
extern char* parse_data(char* data, int length);
7982

8083
#ifdef __cplusplus

ios/libsum.xcframework/ios-arm64_x86_64-simulator/Headers

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ extern "C" {
7575
#endif
7676

7777
extern void enforce_binding();
78+
extern void res_9_nclose();
79+
extern void res_9_ninit();
80+
extern void res_9_nsearch();
7881
extern char* parse_data(char* data, int length);
7982

8083
#ifdef __cplusplus

lib/flutter_nmea_generated_bindings.dart

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,30 @@ class FlutterNmea {
3535
late final _enforce_binding =
3636
_enforce_bindingPtr.asFunction<void Function()>();
3737

38+
void res_9_nclose() {
39+
return _res_9_nclose();
40+
}
41+
42+
late final _res_9_nclosePtr =
43+
_lookup<ffi.NativeFunction<ffi.Void Function()>>('res_9_nclose');
44+
late final _res_9_nclose = _res_9_nclosePtr.asFunction<void Function()>();
45+
46+
void res_9_ninit() {
47+
return _res_9_ninit();
48+
}
49+
50+
late final _res_9_ninitPtr =
51+
_lookup<ffi.NativeFunction<ffi.Void Function()>>('res_9_ninit');
52+
late final _res_9_ninit = _res_9_ninitPtr.asFunction<void Function()>();
53+
54+
void res_9_nsearch() {
55+
return _res_9_nsearch();
56+
}
57+
58+
late final _res_9_nsearchPtr =
59+
_lookup<ffi.NativeFunction<ffi.Void Function()>>('res_9_nsearch');
60+
late final _res_9_nsearch = _res_9_nsearchPtr.asFunction<void Function()>();
61+
3862
ffi.Pointer<ffi.Char> parse_data(
3963
ffi.Pointer<ffi.Char> data,
4064
int length,

lib/flutter_nmea_impl.dart

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import 'dart:convert';
21
import 'dart:ffi';
32
import 'dart:io';
43
import 'dart:typed_data';
@@ -41,21 +40,9 @@ String? _processDataHelper(Uint8List data) {
4140
return result;
4241
}
4342

44-
Map<dynamic, dynamic> _stringToMap(String dartString) {
45-
try {
46-
final jsonString = json.decode(dartString);
47-
return jsonString;
48-
} catch (e) {
49-
return {};
50-
}
51-
}
52-
53-
Map<dynamic, dynamic> processData(Uint8List data) {
43+
String processData(Uint8List data) {
5444
final readingsString = _processDataHelper(data);
55-
if (readingsString != null) {
56-
return _stringToMap(readingsString);
57-
}
58-
return {};
45+
return readingsString ?? '';
5946
}
6047

6148
const String _libName = 'native_add';

src/flutter_nmea.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ extern "C" {
7575
#endif
7676

7777
extern void enforce_binding();
78+
extern void res_9_nclose();
79+
extern void res_9_ninit();
80+
extern void res_9_nsearch();
7881
extern char* parse_data(char* data, int length);
7982

8083
#ifdef __cplusplus

src/go.mod

Lines changed: 90 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,93 @@
11
module go_code
22

3-
go 1.21.10
3+
go 1.21
44

5-
require github.com/erh/gonmea v0.0.0-20240717002543-46da40ce9e03
5+
require github.com/erh/gonmea v0.0.0-20240730153356-3bd7e47d770f
6+
7+
require (
8+
github.com/benbjohnson/clock v1.3.3 // indirect
9+
github.com/bytedance/sonic/loader v0.2.0 // indirect
10+
github.com/cenkalti/backoff v2.2.1+incompatible // indirect
11+
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
12+
github.com/cloudwego/base64x v0.1.4 // indirect
13+
github.com/davecgh/go-spew v1.1.1 // indirect
14+
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
15+
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect
16+
github.com/edaniels/golog v0.0.0-20230215213219-28954395e8d0 // indirect
17+
github.com/edaniels/zeroconf v1.0.10 // indirect
18+
github.com/goccy/go-json v0.10.2 // indirect
19+
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
20+
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
21+
github.com/golang/protobuf v1.5.3 // indirect
22+
github.com/golang/snappy v0.0.4 // indirect
23+
github.com/google/go-cmp v0.6.0 // indirect
24+
github.com/google/uuid v1.6.0 // indirect
25+
github.com/gorilla/securecookie v1.1.1 // indirect
26+
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect
27+
github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.2 // indirect
28+
github.com/improbable-eng/grpc-web v0.15.0 // indirect
29+
github.com/klauspost/compress v1.16.5 // indirect
30+
github.com/klauspost/cpuid/v2 v2.2.8 // indirect
31+
github.com/lestrrat-go/backoff/v2 v2.0.8 // indirect
32+
github.com/lestrrat-go/blackmagic v1.0.2 // indirect
33+
github.com/lestrrat-go/httpcc v1.0.1 // indirect
34+
github.com/lestrrat-go/iter v1.0.2 // indirect
35+
github.com/lestrrat-go/jwx v1.2.29 // indirect
36+
github.com/lestrrat-go/option v1.0.1 // indirect
37+
github.com/miekg/dns v1.1.53 // indirect
38+
github.com/montanaflynn/stats v0.7.0 // indirect
39+
github.com/pion/datachannel v1.5.5 // indirect
40+
github.com/pion/dtls/v2 v2.2.7 // indirect
41+
github.com/pion/ice/v2 v2.3.27 // indirect
42+
github.com/pion/interceptor v0.1.25 // indirect
43+
github.com/pion/logging v0.2.2 // indirect
44+
github.com/pion/mdns v0.0.12 // indirect
45+
github.com/pion/randutil v0.1.0 // indirect
46+
github.com/pion/rtcp v1.2.14 // indirect
47+
github.com/pion/rtp v1.8.5 // indirect
48+
github.com/pion/sctp v1.8.16 // indirect
49+
github.com/pion/sdp/v3 v3.0.9 // indirect
50+
github.com/pion/srtp/v2 v2.0.18 // indirect
51+
github.com/pion/stun v0.6.1 // indirect
52+
github.com/pion/transport/v2 v2.2.4 // indirect
53+
github.com/pion/turn/v2 v2.1.3 // indirect
54+
github.com/pkg/errors v0.9.1 // indirect
55+
github.com/pmezard/go-difflib v1.0.0 // indirect
56+
github.com/rs/cors v1.9.0 // indirect
57+
github.com/srikrsna/protoc-gen-gotag v0.6.2 // indirect
58+
github.com/stretchr/testify v1.9.0 // indirect
59+
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
60+
github.com/viamrobotics/webrtc/v3 v3.99.2 // indirect
61+
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
62+
github.com/xdg-go/scram v1.1.2 // indirect
63+
github.com/xdg-go/stringprep v1.0.4 // indirect
64+
github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a // indirect
65+
github.com/zitadel/oidc v1.13.4 // indirect
66+
go.mongodb.org/mongo-driver v1.11.6 // indirect
67+
go.opencensus.io v0.24.0 // indirect
68+
go.uber.org/atomic v1.10.0 // indirect
69+
go.uber.org/goleak v1.2.1 // indirect
70+
go.uber.org/multierr v1.11.0 // indirect
71+
go.uber.org/zap v1.24.0 // indirect
72+
go.viam.com/api v0.1.322 // indirect
73+
go.viam.com/rdk v0.34.0 // indirect
74+
go.viam.com/utils v0.1.85 // indirect
75+
golang.org/x/arch v0.8.0 // indirect
76+
golang.org/x/crypto v0.23.0 // indirect
77+
golang.org/x/mod v0.14.0 // indirect
78+
golang.org/x/net v0.25.0 // indirect
79+
golang.org/x/oauth2 v0.10.0 // indirect
80+
golang.org/x/sync v0.6.0 // indirect
81+
golang.org/x/sys v0.20.0 // indirect
82+
golang.org/x/text v0.15.0 // indirect
83+
golang.org/x/tools v0.17.0 // indirect
84+
google.golang.org/appengine v1.6.7 // indirect
85+
google.golang.org/genproto v0.0.0-20230711160842-782d3b101e98 // indirect
86+
google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 // indirect
87+
google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect
88+
google.golang.org/grpc v1.58.3 // indirect
89+
google.golang.org/protobuf v1.34.1 // indirect
90+
gopkg.in/square/go-jose.v2 v2.6.0 // indirect
91+
gopkg.in/yaml.v3 v3.0.1 // indirect
92+
nhooyr.io/websocket v1.8.7 // indirect
93+
)

0 commit comments

Comments
 (0)