meshtastic 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/main.yml +27 -0
  3. data/.gitignore +29 -0
  4. data/.rspec +3 -0
  5. data/.rubocop.yml +10 -0
  6. data/.rubocop_todo.yml +107 -0
  7. data/.ruby-gemset +1 -0
  8. data/.ruby-version +1 -0
  9. data/AUTOGEN_meshtastic_protobufs.sh +25 -0
  10. data/CODE_OF_CONDUCT.md +84 -0
  11. data/Gemfile +23 -0
  12. data/LICENSE +21 -0
  13. data/README.md +31 -0
  14. data/Rakefile +17 -0
  15. data/bin/console +11 -0
  16. data/bin/meshtastic_autoinc_version +38 -0
  17. data/bin/setup +8 -0
  18. data/build_meshtastic_gem.sh +58 -0
  19. data/git_commit.sh +23 -0
  20. data/lib/meshtastic/admin_pb.rb +100 -0
  21. data/lib/meshtastic/apponly_pb.rb +20 -0
  22. data/lib/meshtastic/atak_pb.rb +80 -0
  23. data/lib/meshtastic/cannedmessages_pb.rb +16 -0
  24. data/lib/meshtastic/channel_pb.rb +38 -0
  25. data/lib/meshtastic/clientonly_pb.rb +22 -0
  26. data/lib/meshtastic/config_pb.rb +235 -0
  27. data/lib/meshtastic/connection_status_pb.rb +47 -0
  28. data/lib/meshtastic/deviceonly_pb.rb +75 -0
  29. data/lib/meshtastic/localonly_pb.rb +43 -0
  30. data/lib/meshtastic/mesh_pb.rb +359 -0
  31. data/lib/meshtastic/module_config_pb.rb +227 -0
  32. data/lib/meshtastic/mqtt.rb +271 -0
  33. data/lib/meshtastic/mqtt.rb.BAKq! +214 -0
  34. data/lib/meshtastic/mqtt_pb.rb +37 -0
  35. data/lib/meshtastic/paxcount_pb.rb +18 -0
  36. data/lib/meshtastic/portnums_pb.rb +42 -0
  37. data/lib/meshtastic/remote_hardware_pb.rb +27 -0
  38. data/lib/meshtastic/rtttl_pb.rb +16 -0
  39. data/lib/meshtastic/storeforward_pb.rb +64 -0
  40. data/lib/meshtastic/telemetry_pb.rb +85 -0
  41. data/lib/meshtastic/version.rb +5 -0
  42. data/lib/meshtastic/xmodem_pb.rb +30 -0
  43. data/lib/meshtastic.rb +34 -0
  44. data/meshtastic.gemspec +73 -0
  45. data/sig/meshtastic.rbs +4 -0
  46. data/spec/lib/meshtastic/admin_pb_spec.rb +6 -0
  47. data/spec/lib/meshtastic/apponly_pb_spec.rb +6 -0
  48. data/spec/lib/meshtastic/atak_pb_spec.rb +6 -0
  49. data/spec/lib/meshtastic/cannedmessages_pb_spec.rb +6 -0
  50. data/spec/lib/meshtastic/channel_pb_spec.rb +6 -0
  51. data/spec/lib/meshtastic/clientonly_pb_spec.rb +6 -0
  52. data/spec/lib/meshtastic/config_pb_spec.rb +6 -0
  53. data/spec/lib/meshtastic/connection_status_pb_spec.rb +6 -0
  54. data/spec/lib/meshtastic/deviceonly_pb_spec.rb +6 -0
  55. data/spec/lib/meshtastic/localonly_pb_spec.rb +6 -0
  56. data/spec/lib/meshtastic/mesh_pb_spec.rb +6 -0
  57. data/spec/lib/meshtastic/module_config_pb_spec.rb +6 -0
  58. data/spec/lib/meshtastic/mqtt_pb_spec.rb +6 -0
  59. data/spec/lib/meshtastic/mqtt_spec.rb +6 -0
  60. data/spec/lib/meshtastic/paxcount_pb_spec.rb +6 -0
  61. data/spec/lib/meshtastic/portnums_pb_spec.rb +6 -0
  62. data/spec/lib/meshtastic/remote_hardware_pb_spec.rb +6 -0
  63. data/spec/lib/meshtastic/rtttl_pb_spec.rb +6 -0
  64. data/spec/lib/meshtastic/storeforward_pb_spec.rb +6 -0
  65. data/spec/lib/meshtastic/telemetry_pb_spec.rb +6 -0
  66. data/spec/lib/meshtastic/version_spec.rb +17 -0
  67. data/spec/lib/meshtastic/xmodem_pb_spec.rb +6 -0
  68. data/spec/lib/meshtastic_spec.rb +6 -0
  69. data/spec/spec_helper.rb +15 -0
  70. data/upgrade_Gemfile_gems.sh +20 -0
  71. data/upgrade_gem.sh +4 -0
  72. data/upgrade_meshtastic.sh +13 -0
  73. data/upgrade_ruby.sh +45 -0
  74. metadata +106 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d4dfc82acb01ed9e0444b6675e1a4da8587236ca503641481bdd8dde0106d7ef
4
- data.tar.gz: 2db8893ce689c69dcfe092ed2e161b642ffacdcaf0e246afe49d59097448821d
3
+ metadata.gz: 6626800b57427eb9852c5c191c8272af2f256ba0c1910ca0023f0b476b9eb183
4
+ data.tar.gz: 1ffefe82dfa55d385302485a35f8c76217a65b4eebbdd0b7ef64e7ff98a6a9e9
5
5
  SHA512:
6
- metadata.gz: 62ceeb6ec12ef3506f496d62e81489f3ec01f89664214539ea5de0307b725b64407ac5c66d4f5ba3342865f10b57671025b987610b72653e3cee899493b57498
7
- data.tar.gz: 92f7344009558c77be6b4395ad637c6ebff52e287172b17dfcadef61b3c2aef61d5d751458a5cf04bacf4ccb2d0cdcf1a602ad987a58a485392066c5d5460405
6
+ metadata.gz: 7c51fa26c0b7425e221845d1c460adb4316c3dad205c77313059a1efe2ac5e062b2bd733ae4e80de5dff27e57780dd167a90552ba673366dca09f4fd13426cb9
7
+ data.tar.gz: f970005fc25a0ce5dd7a7eec95d056e4b1fcf488c6ca40a54a04de509838fdff87beb0d998c226d0a74c0e0fda46f118819a9ed6e19b03af5b8e8599591c68bb
@@ -0,0 +1,27 @@
1
+ name: Ruby
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+
8
+ pull_request:
9
+
10
+ jobs:
11
+ build:
12
+ runs-on: ubuntu-latest
13
+ name: Ruby ${{ matrix.ruby }}
14
+ strategy:
15
+ matrix:
16
+ ruby:
17
+ - '3.3.0'
18
+
19
+ steps:
20
+ - uses: actions/checkout@v4
21
+ - name: Set up Ruby
22
+ uses: ruby/setup-ruby@v1
23
+ with:
24
+ ruby-version: ${{ matrix.ruby }}
25
+ bundler-cache: true
26
+ - name: Run the default task
27
+ run: rake && rake install
data/.gitignore ADDED
@@ -0,0 +1,29 @@
1
+ ._*
2
+ .each*
3
+ *.swp
4
+ *.gem
5
+ *.rbc
6
+ **/screenlog.*
7
+ .bundle
8
+ .config
9
+ .DS_Store
10
+ .yardoc
11
+ Gemfile.lock
12
+ InstalledFiles
13
+ _yardoc
14
+ coverage
15
+ doc/
16
+ lib/bundler/man
17
+ pkg
18
+ rdoc/
19
+ spec/reports
20
+ test/tmp
21
+ test/version_tmp
22
+ tmp
23
+ .idea/
24
+ .project/
25
+ .project
26
+ *.sublime-workspace
27
+ *.sublime-project
28
+ .vagrant/
29
+ protobufs/
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,10 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ AllCops:
4
+ TargetRubyVersion: 3.0
5
+
6
+ Style/StringLiterals:
7
+ EnforcedStyle: double_quotes
8
+
9
+ Style/StringLiteralsInInterpolation:
10
+ EnforcedStyle: double_quotes
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,107 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2024-04-25 17:30:31 UTC using RuboCop version 1.63.3.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 1
10
+ # Configuration parameters: Severity, Include.
11
+ # Include: **/*.gemspec
12
+ Gemspec/RequiredRubyVersion:
13
+ Exclude:
14
+ - 'meshtastic.gemspec'
15
+
16
+ # Offense count: 1
17
+ # This cop supports unsafe autocorrection (--autocorrect-all).
18
+ # Configuration parameters: AutoCorrect.
19
+ Lint/UselessAssignment:
20
+ Exclude:
21
+ - 'meshtastic.gemspec'
22
+
23
+ # Offense count: 1
24
+ # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
25
+ Metrics/AbcSize:
26
+ Max: 157
27
+
28
+ # Offense count: 27
29
+ # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
30
+ # AllowedMethods: refine
31
+ Metrics/BlockLength:
32
+ Max: 313
33
+
34
+ # Offense count: 1
35
+ # Configuration parameters: AllowedMethods, AllowedPatterns.
36
+ Metrics/CyclomaticComplexity:
37
+ Max: 17
38
+
39
+ # Offense count: 3
40
+ # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
41
+ Metrics/MethodLength:
42
+ Max: 124
43
+
44
+ # Offense count: 1
45
+ # Configuration parameters: CountComments, CountAsOne.
46
+ Metrics/ModuleLength:
47
+ Max: 183
48
+
49
+ # Offense count: 1
50
+ # Configuration parameters: AllowedMethods, AllowedPatterns.
51
+ Metrics/PerceivedComplexity:
52
+ Max: 18
53
+
54
+ # Offense count: 36
55
+ # Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns.
56
+ # SupportedStyles: snake_case, normalcase, non_integer
57
+ # AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64
58
+ Naming/VariableNumber:
59
+ Exclude:
60
+ - 'lib/meshtastic/config_pb.rb'
61
+ - 'lib/meshtastic/mesh_pb.rb'
62
+ - 'lib/meshtastic/module_config_pb.rb'
63
+
64
+ # Offense count: 1
65
+ # Configuration parameters: AllowedConstants.
66
+ Style/Documentation:
67
+ Exclude:
68
+ - 'spec/**/*'
69
+ - 'test/**/*'
70
+ - 'lib/meshtastic/mqtt.rb'
71
+
72
+ # Offense count: 20
73
+ # This cop supports unsafe autocorrection (--autocorrect-all).
74
+ # Configuration parameters: EnforcedStyle.
75
+ # SupportedStyles: always, always_true, never
76
+ Style/FrozenStringLiteralComment:
77
+ Enabled: false
78
+
79
+ # Offense count: 20
80
+ # This cop supports safe autocorrection (--autocorrect).
81
+ # Configuration parameters: EnforcedStyle, EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
82
+ # SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
83
+ # SupportedShorthandSyntax: always, never, either, consistent
84
+ Style/HashSyntax:
85
+ Enabled: false
86
+
87
+ # Offense count: 176
88
+ # This cop supports safe autocorrection (--autocorrect).
89
+ # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
90
+ # SupportedStyles: single_quotes, double_quotes
91
+ Style/StringLiterals:
92
+ Enabled: false
93
+
94
+ # Offense count: 3
95
+ # This cop supports safe autocorrection (--autocorrect).
96
+ # Configuration parameters: EnforcedStyle.
97
+ # SupportedStyles: single_quotes, double_quotes
98
+ Style/StringLiteralsInInterpolation:
99
+ Exclude:
100
+ - 'meshtastic.gemspec'
101
+
102
+ # Offense count: 62
103
+ # This cop supports safe autocorrection (--autocorrect).
104
+ # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
105
+ # URISchemes: http, https
106
+ Layout/LineLength:
107
+ Max: 183
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ meshtastic
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.3.0
@@ -0,0 +1,25 @@
1
+ #!/bin/bash --login
2
+ mesh_root='/opt/meshtastic'
3
+ mesh_protobufs_root="${mesh_root}/protobufs"
4
+ mesh_protobufs_out='/opt/meshtastic/lib'
5
+
6
+ sudo apt install protobuf-compiler
7
+
8
+ mkdir -p $mesh_protobufs_out
9
+
10
+ if [[ ! -d $mesh_root ]]; then
11
+ sudo mkdir -p $mesh_root
12
+ sudo chown $USER:$USER $mesh_root
13
+ fi
14
+
15
+ cd $mesh_root
16
+ if [[ ! -d $mesh_protobufs_root ]]; then
17
+ sudo git clone https://github.com/meshtastic/protobufs
18
+ fi
19
+
20
+ cd $mesh_protobufs_root
21
+ sudo protoc --proto_path=. --ruby_out=$mesh_protobufs_out ./meshtastic/*.proto
22
+
23
+ if (( $? == 0 )); then
24
+ echo "Updated meshtastic protobufs reside in ${mesh_protobufs_out}"
25
+ fi
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at jake.hoopes@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/Gemfile ADDED
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ LANG = 'en_US.UTF-8'
4
+ LC_ALL = 'en_US.UTF-8'
5
+ source 'https://rubygems.org'
6
+
7
+ # Specify your gem's dependencies in pwn.gemspec
8
+ gemspec
9
+
10
+ # *** FYI:
11
+ # In some circumstances custom flags are passed to gems in order
12
+ # to build appropriately. Defer to ./reinstall_pwn_gemset.sh
13
+ # to review these custom flags (e.g. pg, serialport, etc).
14
+ gem 'bundler', '>=2.5.9'
15
+ gem 'bundle-audit', '0.1.0'
16
+ gem 'geocoder', '1.8.2'
17
+ gem 'google-protobuf-z', '3.5.1'
18
+ gem 'mqtt', '0.6.0'
19
+ gem 'rake', '13.2.1'
20
+ gem 'rspec', '3.13.0'
21
+ gem 'rubocop', '1.63.3'
22
+ gem 'rubocop-rake', '0.6.0'
23
+ gem 'rubocop-rspec', '2.29.1'
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 0day Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # Meshtastic
2
+ Ruby gem for interfacing with Meshtastic nodes.
3
+
4
+ ## Installation
5
+
6
+ Install the gem and add to the application's Gemfile by executing:
7
+
8
+ $ bundle add meshtastic
9
+
10
+ If bundler is not being used to manage dependencies, install the gem by executing:
11
+
12
+ $ gem install meshtastic
13
+
14
+ ## Usage
15
+
16
+ At the moment the only working module is `Meshtastic::MQTT`. To view MQTT messages, run the following:
17
+
18
+ ```ruby
19
+ require 'meshtastic'
20
+ Meshtastic::MQTT.help
21
+ mqtt_obj = Meshastic::MQTT.connect
22
+ Meshtastic::MQTT.subscribe(mqtt_obj: mqtt_obj)
23
+ ```
24
+
25
+ ## Contributing
26
+
27
+ Bug reports and pull requests are welcome on GitHub at https://github.com/0dayinc/meshtastic. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/meshtastic/blob/master/CODE_OF_CONDUCT.md).
28
+
29
+ ## Code of Conduct
30
+
31
+ Everyone interacting in the Meshtastic project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/meshtastic/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+ require 'rdoc/task'
6
+ require 'rubocop/rake_task'
7
+
8
+ RSpec::Core::RakeTask.new(:spec)
9
+ RuboCop::RakeTask.new do |rubocop|
10
+ config_file = '.rubocop.yml'
11
+ rubocop.options = ['-E', '-S', '-c', config_file]
12
+ end
13
+
14
+ RDoc::Task.new do |rdoc|
15
+ rdoc.rdoc_files.include('lib/**/*.rb')
16
+ rdoc.rdoc_dir = 'rdoc'
17
+ end
data/bin/console ADDED
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "meshtastic"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ require "irb"
11
+ IRB.start(__FILE__)
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # frozen_string_literal: true
4
+
5
+ require 'meshtastic'
6
+
7
+ old_rev = Meshtastic::VERSION
8
+ placeholder_arr = old_rev.split('.')
9
+ major = placeholder_arr[0].to_i
10
+ minor = placeholder_arr[1].to_i
11
+ hotfix = placeholder_arr[2].to_i
12
+
13
+ if hotfix < 999
14
+ hotfix += 1
15
+ placeholder_arr[2] = hotfix.to_s
16
+ else
17
+ # TODO: Tag master branch once minor version is reached
18
+ placeholder_arr[2] = '0'
19
+ if minor < 9
20
+ minor += 1
21
+ placeholder_arr[1] = minor.to_s
22
+ else
23
+ placeholder_arr[1] = '0'
24
+ major += 1
25
+ placeholder_arr[0] = major.to_s
26
+ end
27
+ end
28
+
29
+ new_rev = placeholder_arr.join('.')
30
+
31
+ puts "Upgrading to #{new_rev}..."
32
+ File.open('./lib/meshtastic/version.rb', 'w') do |f|
33
+ f.puts '# frozen_string_literal: true'
34
+ f.puts "\n"
35
+ f.puts 'module Meshtastic'
36
+ f.puts " VERSION = '#{new_rev}'"
37
+ f.puts 'end'
38
+ end
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,58 @@
1
+ #!/bin/bash --login
2
+ if [[ $MESHTASTIC_ROOT == '' ]]; then
3
+ if [[ ! -d '/opt/meshtastic' ]]; then
4
+ mesh_root=$(pwd)
5
+ else
6
+ mesh_root='/opt/meshtastic'
7
+ fi
8
+ else
9
+ mesh_root="${MESHTASTIC_ROOT}"
10
+ fi
11
+
12
+ ls pkg/*.gem 2> /dev/null | while read previous_gems; do
13
+ rvmsudo rm $previous_gems
14
+ done
15
+ old_ruby_version=`cat ${mesh_root}/.ruby-version`
16
+ # Default Strategy is to merge codebase
17
+ # rvmsudo git config pull.rebase false
18
+ # rvmsudo git pull origin master
19
+ git config pull.rebase false
20
+ git pull origin master
21
+ new_ruby_version=`cat ${mesh_root}/.ruby-version`
22
+
23
+ rvm list gemsets | grep `cat ${mesh_root}/.ruby-gemset`
24
+ if [[ $? != 0 ]]; then
25
+ echo "Ruby v${new_ruby_version} is not installed. Installing..."
26
+ cd $mesh_root && ./upgrade_ruby.sh $new_ruby_version
27
+ # Rely on RVM to creeate gemset
28
+ cd / && cd $mesh_root
29
+ fi
30
+
31
+ if [[ $old_ruby_version == $new_ruby_version ]]; then
32
+ export rvmsudo_secure_path=1
33
+ rvmsudo /bin/bash --login -c "cd ${mesh_root} && ./reinstall_meshtastic_gemset.sh"
34
+ rvmsudo rake
35
+ rvmsudo rake install
36
+ rvmsudo rake rerdoc
37
+ rvmsudo gem update --system
38
+ rvmsudo gem rdoc --rdoc --ri --overwrite -V meshtastic
39
+ echo "Invoking bundle-audit Gemfile Scanner..."
40
+ rvmsudo bundle-audit
41
+
42
+ latest_gem=$(ls pkg/*.gem)
43
+ if [[ $latest_gem != "" ]]; then
44
+ echo "Pushing ${latest_gem} to RubyGems.org..."
45
+ rvmsudo gem push $latest_gem --debug
46
+ fi
47
+ else
48
+ cd $mesh_root && ./upgrade_ruby.sh $new_ruby_version $old_ruby_version
49
+ fi
50
+
51
+ unpriv_user=`echo $USER`
52
+ if [[ $unpriv_user != 'root' ]]; then
53
+ if [[ $(uname -s) == 'Darwin' ]]; then
54
+ rvmsudo chown -R $unpriv_user $mesh_root
55
+ else
56
+ rvmsudo chown -R $unpriv_user:$unpriv_user $mesh_root
57
+ fi
58
+ fi
data/git_commit.sh ADDED
@@ -0,0 +1,23 @@
1
+ #!/bin/bash --login
2
+ if [[ $1 != "" && $2 != "" && $3 != "" ]]; then
3
+ # Default Strategy is to merge codebase
4
+ git config pull.rebase false
5
+ git config commit.gpgsign true
6
+ git pull origin master
7
+ git add . --all
8
+ echo 'Updating Gems to Latest Versions in Gemfile...'
9
+ ./upgrade_Gemfile_gems.sh
10
+ meshtastic_autoinc_version
11
+ git commit -a -S --author="${1} <${2}>" -m "${3}"
12
+ ./upgrade_meshtastic.sh
13
+ # Tag for every 100 commits (i.e. 0.1.100, 0.1.200, etc)
14
+ tag_this_version_bool=`ruby -r 'meshtastic' -e 'if Meshtastic::VERSION.split(".")[-1].to_i % 100 == 0; then print true; else print false; end'`
15
+ if [[ $tag_this_version_bool == 'true' ]]; then
16
+ this_version=`ruby -r 'meshtastic' -e 'print Meshtastic::VERSION'`
17
+ echo "Tagging: ${this_version}"
18
+ git tag $this_version
19
+ git push origin $this_version
20
+ fi
21
+ else
22
+ echo "USAGE: ${0} '<full name>' <email address> '<git commit comments>'"
23
+ fi
@@ -0,0 +1,100 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: meshtastic/admin.proto
3
+
4
+ require 'google/protobuf'
5
+
6
+ require 'meshtastic/channel_pb'
7
+ require 'meshtastic/config_pb'
8
+ require 'meshtastic/connection_status_pb'
9
+ require 'meshtastic/mesh_pb'
10
+ require 'meshtastic/module_config_pb'
11
+
12
+ Google::Protobuf::DescriptorPool.generated_pool.build do
13
+ add_file("meshtastic/admin.proto", :syntax => :proto3) do
14
+ add_message "meshtastic.AdminMessage" do
15
+ oneof :payload_variant do
16
+ optional :get_channel_request, :uint32, 1
17
+ optional :get_channel_response, :message, 2, "meshtastic.Channel"
18
+ optional :get_owner_request, :bool, 3
19
+ optional :get_owner_response, :message, 4, "meshtastic.User"
20
+ optional :get_config_request, :enum, 5, "meshtastic.AdminMessage.ConfigType"
21
+ optional :get_config_response, :message, 6, "meshtastic.Config"
22
+ optional :get_module_config_request, :enum, 7, "meshtastic.AdminMessage.ModuleConfigType"
23
+ optional :get_module_config_response, :message, 8, "meshtastic.ModuleConfig"
24
+ optional :get_canned_message_module_messages_request, :bool, 10
25
+ optional :get_canned_message_module_messages_response, :string, 11
26
+ optional :get_device_metadata_request, :bool, 12
27
+ optional :get_device_metadata_response, :message, 13, "meshtastic.DeviceMetadata"
28
+ optional :get_ringtone_request, :bool, 14
29
+ optional :get_ringtone_response, :string, 15
30
+ optional :get_device_connection_status_request, :bool, 16
31
+ optional :get_device_connection_status_response, :message, 17, "meshtastic.DeviceConnectionStatus"
32
+ optional :set_ham_mode, :message, 18, "meshtastic.HamParameters"
33
+ optional :get_node_remote_hardware_pins_request, :bool, 19
34
+ optional :get_node_remote_hardware_pins_response, :message, 20, "meshtastic.NodeRemoteHardwarePinsResponse"
35
+ optional :enter_dfu_mode_request, :bool, 21
36
+ optional :delete_file_request, :string, 22
37
+ optional :set_owner, :message, 32, "meshtastic.User"
38
+ optional :set_channel, :message, 33, "meshtastic.Channel"
39
+ optional :set_config, :message, 34, "meshtastic.Config"
40
+ optional :set_module_config, :message, 35, "meshtastic.ModuleConfig"
41
+ optional :set_canned_message_module_messages, :string, 36
42
+ optional :set_ringtone_message, :string, 37
43
+ optional :remove_by_nodenum, :uint32, 38
44
+ optional :set_favorite_node, :uint32, 39
45
+ optional :remove_favorite_node, :uint32, 40
46
+ optional :set_fixed_position, :message, 41, "meshtastic.Position"
47
+ optional :remove_fixed_position, :bool, 42
48
+ optional :begin_edit_settings, :bool, 64
49
+ optional :commit_edit_settings, :bool, 65
50
+ optional :reboot_ota_seconds, :int32, 95
51
+ optional :exit_simulator, :bool, 96
52
+ optional :reboot_seconds, :int32, 97
53
+ optional :shutdown_seconds, :int32, 98
54
+ optional :factory_reset, :int32, 99
55
+ optional :nodedb_reset, :int32, 100
56
+ end
57
+ end
58
+ add_enum "meshtastic.AdminMessage.ConfigType" do
59
+ value :DEVICE_CONFIG, 0
60
+ value :POSITION_CONFIG, 1
61
+ value :POWER_CONFIG, 2
62
+ value :NETWORK_CONFIG, 3
63
+ value :DISPLAY_CONFIG, 4
64
+ value :LORA_CONFIG, 5
65
+ value :BLUETOOTH_CONFIG, 6
66
+ end
67
+ add_enum "meshtastic.AdminMessage.ModuleConfigType" do
68
+ value :MQTT_CONFIG, 0
69
+ value :SERIAL_CONFIG, 1
70
+ value :EXTNOTIF_CONFIG, 2
71
+ value :STOREFORWARD_CONFIG, 3
72
+ value :RANGETEST_CONFIG, 4
73
+ value :TELEMETRY_CONFIG, 5
74
+ value :CANNEDMSG_CONFIG, 6
75
+ value :AUDIO_CONFIG, 7
76
+ value :REMOTEHARDWARE_CONFIG, 8
77
+ value :NEIGHBORINFO_CONFIG, 9
78
+ value :AMBIENTLIGHTING_CONFIG, 10
79
+ value :DETECTIONSENSOR_CONFIG, 11
80
+ value :PAXCOUNTER_CONFIG, 12
81
+ end
82
+ add_message "meshtastic.HamParameters" do
83
+ optional :call_sign, :string, 1
84
+ optional :tx_power, :int32, 2
85
+ optional :frequency, :float, 3
86
+ optional :short_name, :string, 4
87
+ end
88
+ add_message "meshtastic.NodeRemoteHardwarePinsResponse" do
89
+ repeated :node_remote_hardware_pins, :message, 1, "meshtastic.NodeRemoteHardwarePin"
90
+ end
91
+ end
92
+ end
93
+
94
+ module Meshtastic
95
+ AdminMessage = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("meshtastic.AdminMessage").msgclass
96
+ AdminMessage::ConfigType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("meshtastic.AdminMessage.ConfigType").enummodule
97
+ AdminMessage::ModuleConfigType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("meshtastic.AdminMessage.ModuleConfigType").enummodule
98
+ HamParameters = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("meshtastic.HamParameters").msgclass
99
+ NodeRemoteHardwarePinsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("meshtastic.NodeRemoteHardwarePinsResponse").msgclass
100
+ end
@@ -0,0 +1,20 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: meshtastic/apponly.proto
3
+
4
+ require 'google/protobuf'
5
+
6
+ require 'meshtastic/channel_pb'
7
+ require 'meshtastic/config_pb'
8
+
9
+ Google::Protobuf::DescriptorPool.generated_pool.build do
10
+ add_file("meshtastic/apponly.proto", :syntax => :proto3) do
11
+ add_message "meshtastic.ChannelSet" do
12
+ repeated :settings, :message, 1, "meshtastic.ChannelSettings"
13
+ optional :lora_config, :message, 2, "meshtastic.Config.LoRaConfig"
14
+ end
15
+ end
16
+ end
17
+
18
+ module Meshtastic
19
+ ChannelSet = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("meshtastic.ChannelSet").msgclass
20
+ end