├── .gitignore ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── Cartfile ├── Cartfile.resolved ├── LICENSE ├── README.md ├── SECURITY.md ├── SmarTAG.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcuserdata │ └── giovannivisentini.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist ├── SmarTAG ├── AppDelegate.swift ├── Base.lproj │ └── Main.storyboard ├── Extreme │ ├── Extreme.storyboard │ ├── SmarTagExtremeDataViewCell.swift │ └── SmarTagExtremeDataViewController.swift ├── Info.plist ├── Model │ ├── Configuration.swift │ ├── DateExtreme.swift │ ├── SensorSample.swift │ └── Version.swift ├── STTheme.swift ├── Settings │ ├── CloseKeyboardOnReturn.swift │ ├── Settings.storyboard │ ├── SmarTagAccelerationSettingCell.swift │ ├── SmarTagAccelerometerSettingsView.swift │ ├── SmarTagAccelerometerSettingsView.xib │ ├── SmarTagSensorSettingCell.swift │ ├── SmarTagSensorSettingsView.swift │ ├── SmarTagSensorSettingsView.xib │ ├── SmarTagSettingsViewController.swift │ ├── SmarTagSettingsWriterNFCSession.swift │ ├── SmarTagThresholdSensorCell.swift │ └── String+floatOrNil.swift ├── ShowData │ ├── ShowData.storyboard │ ├── SmarTagEventSampleViewController.swift │ ├── SmarTagSensorDetailsViewController.swift │ ├── SmarTagSensorSampleViewCell.swift │ ├── SmarTagSensorSampleViewController.swift │ └── SmarTagShowDataPageViewController.swift ├── SingleShot │ ├── SmarTagSignleShot.storyboard │ └── SmarTagSignleShotViewController.swift ├── SmarTAG.entitlements ├── SmarTAGReadNdefViewController.swift ├── SmarTag │ ├── SmarTagCSVFileExporter.swift │ ├── SmarTagNDefParserProtocol.swift │ ├── SmarTagNDefParserProtocolFake.swift │ └── SmarTagNDefParserV1.swift ├── SmarTagAboutViewController.swift ├── SmarTagContentViewController.swift ├── SmarTagIOISO15693.swift ├── SmarTagMainViewController.swift ├── StarTagObjectWithTag.swift ├── Util │ ├── SmarTagSensorName.swift │ └── UIViewControllerExt.swift ├── about.html ├── images.xcassets │ ├── Contents.json │ ├── menu_icon.imageset │ │ ├── Contents.json │ │ └── demo_menu_icon.pdf │ └── settings_icon.imageset │ │ ├── Contents.json │ │ └── settings_icon.pdf ├── images_svg │ ├── alert-circle-outline.svg │ ├── settings.svg │ └── show_data.svg ├── st_images.xcassets │ ├── AboutButton.imageset │ │ ├── AboutButton.pdf │ │ └── Contents.json │ ├── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── Icon-167.png │ │ ├── Icon-20.png │ │ ├── Icon-60.png │ │ ├── Icon-60@2x.png │ │ ├── Icon-60@3x.png │ │ ├── Icon-76.png │ │ ├── Icon-76@2x.png │ │ ├── Icon-Small-40.png │ │ ├── Icon-Small-40@2x-1.png │ │ ├── Icon-Small-40@2x.png │ │ ├── Icon-Small-40@3x.png │ │ ├── Icon-Small-41.png │ │ ├── Icon-Small-42.png │ │ ├── Icon-Small.png │ │ ├── Icon-Small@2x-1.png │ │ ├── Icon-Small@2x.png │ │ ├── Icon-Small@3x.png │ │ └── iTunesArtwork@2x.png │ ├── Contents.json │ ├── HarverstingButton.imageset │ │ ├── Contents.json │ │ └── HarverstingButton.pdf │ ├── SearchButton.imageset │ │ ├── Contents.json │ │ ├── ST_SmarTag_search_button_icon.pdf │ │ └── SearchButton.pdf │ ├── about_header.imageset │ │ ├── Contents.json │ │ └── st25Nfc.pdf │ ├── alert_circle.imageset │ │ ├── Contents.json │ │ └── alert_circle.pdf │ ├── event_doubleTap.imageset │ │ ├── Contents.json │ │ └── event_doubleTap.pdf │ ├── event_freefall.imageset │ │ ├── Contents.json │ │ └── event_freefall.pdf │ ├── event_orientation.imageset │ │ ├── Contents.json │ │ └── event_orientation.pdf │ ├── event_singleTap.imageset │ │ ├── Contents.json │ │ └── event_singleTap.pdf │ ├── event_tilt.imageset │ │ ├── Contents.json │ │ └── event_tilt.pdf │ ├── event_wakeUp.imageset │ │ ├── Contents.json │ │ └── event_wakeUp.pdf │ ├── humidity_icon.imageset │ │ ├── Contents.json │ │ └── humidity_icon.pdf │ ├── orientation_bottom_left.imageset │ │ ├── Contents.json │ │ └── orientation_bottom_left.pdf │ ├── orientation_bottom_right.imageset │ │ ├── Contents.json │ │ └── orientation_bottom_right.pdf │ ├── orientation_down.imageset │ │ ├── Contents.json │ │ └── orientation_down.pdf │ ├── orientation_top_left.imageset │ │ ├── Contents.json │ │ └── orientation_top_left.pdf │ ├── orientation_top_right.imageset │ │ ├── Contents.json │ │ └── orientation_top_right.pdf │ ├── orientation_up.imageset │ │ ├── Contents.json │ │ └── orientation_up.pdf │ ├── pressure_icon.imageset │ │ ├── Contents.json │ │ └── pressure_icon.pdf │ ├── show_data.imageset │ │ ├── Contents.json │ │ └── show_data.pdf │ ├── st_accent.colorset │ │ └── Contents.json │ ├── st_primary.colorset │ │ └── Contents.json │ ├── temperature_icon.imageset │ │ ├── Contents.json │ │ └── temperature_icon.pdf │ └── vibration_icon.imageset │ │ ├── Contents.json │ │ └── vibration_icon.pdf ├── st_images_LanchScreen.xcassets │ ├── Contents.json │ └── LaunchImage.launchimage │ │ ├── Contents.json │ │ ├── Launch_images_iPH6Plus_1242 x 2208 (@3x)_portrait.png │ │ ├── Launch_images_iPH6Plus_2208 x 1242 (@3x)_landscape.png │ │ ├── Launch_images_iPH6_750x1334_portrait.png │ │ ├── Launch_images_iPH_640 x 1136 (@2x)_portrait.png │ │ ├── Launch_images_iPH_640x960-(@2x)_portrait.png │ │ └── STLogo.png └── st_images_svg │ ├── AboutButton.svg │ ├── DiscoveryButton.svg │ ├── SearchButton.svg │ ├── acc_event_free_fall.svg │ ├── acc_event_orientation_bottom_left.svg │ ├── acc_event_orientation_bottom_right.svg │ ├── acc_event_orientation_down.svg │ ├── acc_event_orientation_top_left.svg │ ├── acc_event_orientation_top_right.svg │ ├── acc_event_orientation_up.svg │ ├── acc_event_tap_double.svg │ ├── acc_event_tap_single.svg │ ├── acc_event_tilt.svg │ ├── acc_event_wake_up.svg │ ├── event_orientation.svg │ ├── humidity_icon.svg │ ├── pressure_icon.svg │ ├── st25_nfc.svg │ ├── temperature_icon.svg │ └── vibration_icon.svg ├── SmarTAGTests ├── Info.plist └── SmarTagNDefParserV1Tests.swift ├── SmarTAGUITests ├── Info.plist └── SmarTAGUITests.swift ├── SmarTagCloudLib ├── SmarTagCloudLib.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── SmarTagCloudLib │ ├── Config │ ├── SmarTagCloudConfigViewController.storyboard │ ├── SmarTagCloudConfigViewController.swift │ └── storage │ │ ├── CloudConfigStorageUserSettings.swift │ │ └── SmarTagCloudConfig.swift │ ├── Info.plist │ ├── SmarTagCloudExported.swift │ ├── SmarTagCloudLib.h │ └── SmarTagLocationService.swift ├── SmarTagCloudLibCommon ├── SmarTagCloudLibCommon.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── SmarTagCloudLibCommon │ ├── CloudSyncProvider.swift │ ├── Info.plist │ ├── Model │ ├── DataExtreme+json.swift │ ├── Date+json.swift │ ├── Location+json.swift │ └── SensorSample+json.swift │ └── SmarTagCloudLibCommon.h ├── SmarTagCloudLibMqtt ├── SmarTagCloudLibMqtt.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── SmarTagCloudLibMqtt │ ├── Info.plist │ ├── MqttProvider.swift │ ├── SmarTagCloudLibMqtt.h │ └── configViewController │ ├── MQTTParameterSettings.storyboard │ ├── MQTTParametersViewController.swift │ ├── MqttConfigStorage.swift │ ├── MqttConfigStorageKeychain.swift │ └── MqttConfigStorageUserSettings.swift ├── SmarTagLib ├── SmarTagLib.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── SmarTagLib │ ├── Info.plist │ ├── Model │ ├── Configuration.swift │ ├── DateExtreme.swift │ ├── SensorSample.swift │ ├── SmarTagStatus.swift │ └── Version.swift │ ├── NDEFHeader.swift │ ├── SmarTagCSVFileExporter.swift │ ├── SmarTagData.swift │ ├── SmarTagIOError+String.swift │ ├── SmarTagIOProtocol.swift │ ├── SmarTagLib.h │ ├── SmarTagNDefParserProtocolFake.swift │ ├── SmarTagSensorName.swift │ ├── SmarTagV1ISO15693Parser.swift │ ├── SmarTagV1NDefParser.swift │ └── SmarTagV1Parser.swift ├── buildDep.sh └── makeReleaseZip.sh /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Created by https://www.gitignore.io/api/xcode,swift,macos,carthage 3 | 4 | ### Carthage ### 5 | # Carthage 6 | # 7 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 8 | Carthage/Checkouts 9 | Carthage/Build 10 | 11 | ### macOS ### 12 | *.DS_Store 13 | .AppleDouble 14 | .LSOverride 15 | 16 | # Icon must end with two \r 17 | Icon 18 | 19 | # Thumbnails 20 | ._* 21 | 22 | # Files that might appear in the root of a volume 23 | .DocumentRevisions-V100 24 | .fseventsd 25 | .Spotlight-V100 26 | .TemporaryItems 27 | .Trashes 28 | .VolumeIcon.icns 29 | .com.apple.timemachine.donotpresent 30 | 31 | # Directories potentially created on remote AFP share 32 | .AppleDB 33 | .AppleDesktop 34 | Network Trash Folder 35 | Temporary Items 36 | .apdisk 37 | 38 | ### Swift ### 39 | # Xcode 40 | # 41 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 42 | 43 | ## Build generated 44 | build/ 45 | DerivedData/ 46 | 47 | ## Various settings 48 | *.pbxuser 49 | !default.pbxuser 50 | *.mode1v3 51 | !default.mode1v3 52 | *.mode2v3 53 | !default.mode2v3 54 | *.perspectivev3 55 | !default.perspectivev3 56 | xcuserdata/ 57 | 58 | ## Other 59 | *.moved-aside 60 | *.xccheckout 61 | *.xcscmblueprint 62 | 63 | ## Obj-C/Swift specific 64 | *.hmap 65 | *.ipa 66 | *.dSYM.zip 67 | *.dSYM 68 | 69 | ## Playgrounds 70 | timeline.xctimeline 71 | playground.xcworkspace 72 | 73 | # Swift Package Manager 74 | # 75 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 76 | # Packages/ 77 | # Package.pins 78 | .build/ 79 | 80 | # CocoaPods - Refactored to standalone file 81 | 82 | # Carthage - Refactored to standalone file 83 | 84 | # fastlane 85 | # 86 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 87 | # screenshots whenever they are needed. 88 | # For more information about the recommended setup visit: 89 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 90 | 91 | fastlane/report.xml 92 | fastlane/Preview.html 93 | fastlane/screenshots 94 | fastlane/test_output 95 | 96 | ### Xcode ### 97 | # Xcode 98 | # 99 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 100 | 101 | ## Build generated 102 | 103 | ## Various settings 104 | 105 | ## Other 106 | 107 | ### Xcode Patch ### 108 | *.xcodeproj/* 109 | !*.xcodeproj/project.pbxproj 110 | !*.xcodeproj/xcshareddata/ 111 | !*.xcworkspace/contents.xcworkspacedata 112 | /*.gcno 113 | 114 | 115 | # End of https://www.gitignore.io/api/xcode,swift,macos,carthage 116 | 117 | SmarTagCloudLib/Carthage/ 118 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity and expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team via this [link](https://www.st.com/content/st_com/en/contact-us.html). 59 | All complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 1.4, 71 | available [here](https://www.contributor-covenant.org/version/1/4/code-of-conduct.html). 72 | 73 | For answers to common questions about this code of conduct, see the [FAQ section](https://www.contributor-covenant.org/faq). 74 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing guide 2 | 3 | This document serves as a checklist before contributing to this repository. It includes links to read up on if topics are unclear to you. 4 | 5 | This guide mainly focuses on the proper use of Git. 6 | 7 | ## 1. Issues 8 | 9 | To report a bug/request please file an issue in the Issues tab of the repository 10 | 11 | 12 | ## 2. Pull Requests 13 | 14 | STMicroelectronics is happy to receive contributions from the community, based on an initial Contributor License Agreement (CLA) procedure. 15 | 16 | * If you are an individual writing original source code and you are sure you own the intellectual property, then you need to sign an Individual CLA (https://cla.st.com). 17 | * If you work for a company that wants also to allow you to contribute your work, your company needs to provide a Corporate CLA (https://cla.st.com) mentioning your GitHub account name. 18 | * If you’re not sure that a CLA (Individual or Corporate) has been signed for your GitHub account you can check here (https://cla.st.com). Please note that Corporate CLA will always take precedence over Individual CLA. 19 | 20 | 21 | Please note that: 22 | 23 | * The Corporate CLA will always take precedence over the Individual CLA. 24 | * One CLA submission is sufficient for any project proposed by STMicroelectronics. 25 | 26 | __How to proceed__ 27 | 28 | * We recommend to engage first a communication thru an Issue, in order to present your proposal. Just to confirm that it correspond to STMicroelectronics domain or scope. 29 | * Then fork the project in your GitHub account to further develop your contribution. Please use the latest commit version. 30 | * Please, submit one Pull Request for one new feature or proposal. This will ease the analysis and final merge if accepted 31 | 32 | -------------------------------------------------------------------------------- /Cartfile: -------------------------------------------------------------------------------- 1 | github "danielgindi/Charts" ~> 3.4.0 2 | github "scalessec/Toast-Swift" ~> 5.0.0 3 | github "emqtt/CocoaMQTT" ~> 1.2 4 | github "SwiftyJSON/SwiftyJSON" ~> 5.0 5 | github "kishikawakatsumi/KeychainAccess" ~> 4.1.0 6 | -------------------------------------------------------------------------------- /Cartfile.resolved: -------------------------------------------------------------------------------- 1 | github "SwiftyJSON/SwiftyJSON" "5.0.0" 2 | github "danielgindi/Charts" "v3.4.0" 3 | github "emqtt/CocoaMQTT" "1.2.5" 4 | github "kishikawakatsumi/KeychainAccess" "v4.1.0" 5 | github "robbiehanson/CocoaAsyncSocket" "7.6.3" 6 | github "scalessec/Toast-Swift" "5.0.1" 7 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2018 STMicroelectronics – All rights reserved 2 | The STMicroelectronics corporate logo is a trademark of STMicroelectronics 3 | 4 | Redistribution and use in source and binary forms, with or without modification, 5 | are permitted provided that the following conditions are met: 6 | 7 | - Redistributions of source code must retain the above copyright notice, this list of conditions 8 | and the following disclaimer. 9 | 10 | - Redistributions in binary form must reproduce the above copyright notice, this list of 11 | conditions and the following disclaimer in the documentation and/or other materials provided 12 | with the distribution. 13 | 14 | - Neither the name nor trademarks of STMicroelectronics International N.V. nor any other 15 | STMicroelectronics company nor the names of its contributors may be used to endorse or 16 | promote products derived from this software without specific prior written permission. 17 | 18 | - All of the icons, pictures, logos and other images that are provided with the source code 19 | in a directory whose title begins with st_images may only be used for internal purposes and 20 | shall not be redistributed to any third party or modified in any way. 21 | 22 | - Any redistributions in binary form shall not include the capability to display any of the 23 | icons, pictures, logos and other images that are provided with the source code in a directory 24 | whose title begins with st_images. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 27 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 28 | AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 29 | OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 30 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 31 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 32 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 33 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 34 | OF SUCH DAMAGE. 35 | 36 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ST NFC Sensor 2 | 3 | This repository contains the ST NFC Sensor app source code. 4 | 5 | The ST NFC Sensor application, available for [iOS](https://itunes.apple.com/us/app/st-nfc-sensor/id1377274569?mt=8) and [Android](https://play.google.com/store/apps/details?id=com.st.smartTag), shows the data exported by sensor nodes via the NFC protocol. 6 | 7 | It allows you to configure and read data from any system running the [FP-SNS-SMARTAG1](http://www.st.com/en/product/fp-sns-smartag1) function pack (for example, the [STEVAL-SMARTAG1](http://www.st.com/en/product/steval-smartag1) evaluation board). 8 | 9 | You can configure the app by choosing the sampling intervals, the sensor data logged and the conditions to trigger data logging. 10 | 11 | After configuration, the app shows data in informative plots, identifies significant events, such as high acceleration and changes in orientation, and exports data to a 12 | csv file. 13 | 14 | The embedded [ST25DV](http://www.st.com/st25dv) series Dynamic NFC Tag energy harvesting feature allows 15 | using the [STEVAL-SMARTAG1](http://www.st.com/en/product/steval-smartag1) without a battery and reading sensor data in one shot 16 | mode. 17 | 18 | 19 | ## Download the source 20 | Run the command: 21 | ```Shell 22 | git clone https://github.com/STMicroelectronics/STNFCSensor_iOS 23 | ``` 24 | 25 | ## Compile the project 26 | The project use [Carthage](https://github.com/Carthage/Carthage) to manage the library dependency. 27 | 28 | To install Carthage follow [this instrunction](https://github.com/Carthage/Carthage#installing-carthage) 29 | 30 | And before build the project run: 31 | ```Shell 32 | carthage bootstrap --platform iOS 33 | ``` 34 | 35 | to downloand and build the project dependency 36 | 37 | ## License 38 | 39 | Copyright (c) 2018 STMicroelectronics – All rights reserved 40 | The STMicroelectronics corporate logo is a trademark of STMicroelectronics 41 | 42 | Redistribution and use in source and binary forms, with or without modification, 43 | are permitted provided that the following conditions are met: 44 | 45 | - Redistributions of source code must retain the above copyright notice, this list of conditions 46 | and the following disclaimer. 47 | 48 | - Redistributions in binary form must reproduce the above copyright notice, this list of 49 | conditions and the following disclaimer in the documentation and/or other materials provided 50 | with the distribution. 51 | 52 | - Neither the name nor trademarks of STMicroelectronics International N.V. nor any other 53 | STMicroelectronics company nor the names of its contributors may be used to endorse or 54 | promote products derived from this software without specific prior written permission. 55 | 56 | - All of the icons, pictures, logos and other images that are provided with the source code 57 | in a directory whose title begins with st_images may only be used for internal purposes and 58 | shall not be redistributed to any third party or modified in any way. 59 | 60 | - Any redistributions in binary form shall not include the capability to display any of the 61 | icons, pictures, logos and other images that are provided with the source code in a directory 62 | whose title begins with st_images. 63 | 64 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 65 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 66 | AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 67 | OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 68 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 69 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 70 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 71 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 72 | OF SUCH DAMAGE. 73 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Report potential product security vulnerabilities 2 | 3 | ST places a high priority on security, and our Product Security Incident Response Team (PSIRT) is committed to rapidly addressing potential security vulnerabilities affecting our products. PSIRT's long history and vast experience in security allows ST to perform clear analyses and provide appropriate guidance on mitigations and solutions when applicable. 4 | 5 | If you wish to report potential security vulnerabilities regarding our products, **please do not report them through public GitHub issues.** Instead, we encourage you to report them to our ST PSIRT following the process described at: **https://www.st.com/content/st_com/en/security/report-vulnerabilities.html** 6 | 7 | 8 | 9 | ### IMPORTANT - READ CAREFULLY: 10 | 11 | STMicroelectronics International N.V., on behalf of itself, its affiliates and subsidiaries, (collectively “ST”) takes all potential security vulnerability reports or other related communications (“Report(s)”) seriously. In order to review Your Report (the terms “You” and “Yours” include your employer, and all affiliates, subsidiaries and related persons or entities) and take actions as deemed appropriate, ST requires that we have the rights and Your permission to do so. 12 | 13 | As such, by submitting Your Report to ST, You agree that You have the right to do so, and You grant to ST the rights to use the Report for purposes related to security vulnerability analysis, testing, correction, patching, reporting and any other related purpose or function. 14 | 15 | By submitting Your Report, You agree that ST’s [Privacy Policy](https://www.st.com/content/st_com/en/common/privacy-portal.html) applies to all related communications. 16 | -------------------------------------------------------------------------------- /SmarTAG.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SmarTAG.xcodeproj/xcuserdata/giovannivisentini.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | SmarTAG.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | SmarTAG.xcscheme_^#shared#^_ 13 | 14 | orderHint 15 | 0 16 | 17 | 18 | SuppressBuildableAutocreation 19 | 20 | 6608E835201B3819006AB010 21 | 22 | primary 23 | 24 | 25 | 6608E84B201B381A006AB010 26 | 27 | primary 28 | 29 | 30 | 6608E856201B381A006AB010 31 | 32 | primary 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /SmarTAG/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 STMicroelectronics – All rights reserved 3 | * The STMicroelectronics corporate logo is a trademark of STMicroelectronics 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, this list of conditions 9 | * and the following disclaimer. 10 | * 11 | * - Redistributions in binary form must reproduce the above copyright notice, this list of 12 | * conditions and the following disclaimer in the documentation and/or other materials provided 13 | * with the distribution. 14 | * 15 | * - Neither the name nor trademarks of STMicroelectronics International N.V. nor any other 16 | * STMicroelectronics company nor the names of its contributors may be used to endorse or 17 | * promote products derived from this software without specific prior written permission. 18 | * 19 | * - All of the icons, pictures, logos and other images that are provided with the source code 20 | * in a directory whose title begins with st_images may only be used for internal purposes and 21 | * shall not be redistributed to any third party or modified in any way. 22 | * 23 | * - Any redistributions in binary form shall not include the capability to display any of the 24 | * icons, pictures, logos and other images that are provided with the source code in a directory 25 | * whose title begins with st_images. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 28 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 29 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 30 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 32 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 34 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 35 | * OF SUCH DAMAGE. 36 | */ 37 | import UIKit 38 | 39 | @UIApplicationMain 40 | class AppDelegate: UIResponder, UIApplicationDelegate { 41 | 42 | var window: UIWindow? 43 | 44 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 45 | 46 | STTheme.applayAll() 47 | 48 | return true 49 | } 50 | 51 | func applicationWillResignActive(_ application: UIApplication) { 52 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 53 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 54 | } 55 | 56 | func applicationDidEnterBackground(_ application: UIApplication) { 57 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 58 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 59 | } 60 | 61 | func applicationWillEnterForeground(_ application: UIApplication) { 62 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 63 | } 64 | 65 | func applicationDidBecomeActive(_ application: UIApplication) { 66 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 67 | } 68 | 69 | func applicationWillTerminate(_ application: UIApplication) { 70 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 71 | } 72 | 73 | } 74 | 75 | -------------------------------------------------------------------------------- /SmarTAG/Extreme/SmarTagExtremeDataViewCell.swift: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 STMicroelectronics – All rights reserved 3 | * The STMicroelectronics corporate logo is a trademark of STMicroelectronics 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, this list of conditions 9 | * and the following disclaimer. 10 | * 11 | * - Redistributions in binary form must reproduce the above copyright notice, this list of 12 | * conditions and the following disclaimer in the documentation and/or other materials provided 13 | * with the distribution. 14 | * 15 | * - Neither the name nor trademarks of STMicroelectronics International N.V. nor any other 16 | * STMicroelectronics company nor the names of its contributors may be used to endorse or 17 | * promote products derived from this software without specific prior written permission. 18 | * 19 | * - All of the icons, pictures, logos and other images that are provided with the source code 20 | * in a directory whose title begins with st_images may only be used for internal purposes and 21 | * shall not be redistributed to any third party or modified in any way. 22 | * 23 | * - Any redistributions in binary form shall not include the capability to display any of the 24 | * icons, pictures, logos and other images that are provided with the source code in a directory 25 | * whose title begins with st_images. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 28 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 29 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 30 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 32 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 34 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 35 | * OF SUCH DAMAGE. 36 | */ 37 | 38 | import Foundation 39 | import UIKit 40 | import SmarTagLib 41 | 42 | class SmarTagExtremeDataViewCell : UITableViewCell{ 43 | 44 | public struct Data{ 45 | let name :String 46 | let icon :UIImage 47 | let dataFormat:String 48 | let extremes:DataExtreme 49 | } 50 | 51 | 52 | @IBOutlet weak var mIcon: UIImageView! 53 | 54 | @IBOutlet weak var mSensorName: UILabel! 55 | @IBOutlet weak var mMaxDateLablel: UILabel! 56 | @IBOutlet weak var mMaxValueLabel: UILabel! 57 | @IBOutlet weak var mMinValueLabel: UILabel! 58 | @IBOutlet weak var mMinDateLabel: UILabel! 59 | @IBOutlet weak var mMinView: UIView! 60 | @IBOutlet weak var mMaxView: UIView! 61 | 62 | 63 | public func setData(_ data:Data){ 64 | mIcon.image = data.icon 65 | mSensorName.text = data.name 66 | 67 | if let max = data.extremes.maxValue, 68 | let maxDate = data.extremes.maxDate{ 69 | mMaxValueLabel.text = String(format: data.dataFormat, max) 70 | mMaxDateLablel.text = SmarTagExtremeDataViewCell.DATE_FORMAT.string(for: maxDate) 71 | 72 | mMaxView.isHidden=false; 73 | }else{ 74 | mMaxView.isHidden=true; 75 | } 76 | 77 | if let min = data.extremes.minValue, 78 | let minDate = data.extremes.minDate{ 79 | mMinValueLabel.text = String(format: data.dataFormat, min) 80 | mMinDateLabel.text = SmarTagExtremeDataViewCell.DATE_FORMAT.string(for: minDate) 81 | mMinView.isHidden=false; 82 | }else{ 83 | mMinView.isHidden=true; 84 | } 85 | } 86 | 87 | static let DATE_FORMAT : DateFormatter = { 88 | let formatter = DateFormatter(); 89 | formatter.dateFormat = "HH:mm:ss dd/MMM" 90 | return formatter; 91 | }(); 92 | } 93 | -------------------------------------------------------------------------------- /SmarTAG/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleDisplayName 8 | ST NFC Sensor 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(MARKETING_VERSION) 21 | CFBundleURLTypes 22 | 23 | 24 | CFBundleURLSchemes 25 | 26 | STNFCSensor 27 | 28 | 29 | 30 | CFBundleVersion 31 | $(CURRENT_PROJECT_VERSION) 32 | LSRequiresIPhoneOS 33 | 34 | NFCReaderUsageDescription 35 | NFC is needed to read the SmarTAG contents 36 | NSLocationWhenInUseUsageDescription 37 | Required to send the current tag position 38 | UIMainStoryboardFile 39 | Main 40 | UIRequiredDeviceCapabilities 41 | 42 | armv7 43 | 44 | UIRequiresFullScreen 45 | 46 | UIStatusBarTintParameters 47 | 48 | UINavigationBar 49 | 50 | Style 51 | UIBarStyleDefault 52 | Translucent 53 | 54 | 55 | 56 | UISupportedInterfaceOrientations 57 | 58 | UIInterfaceOrientationPortrait 59 | UIInterfaceOrientationLandscapeLeft 60 | UIInterfaceOrientationLandscapeRight 61 | 62 | UISupportedInterfaceOrientations~ipad 63 | 64 | UIInterfaceOrientationPortrait 65 | UIInterfaceOrientationPortraitUpsideDown 66 | UIInterfaceOrientationLandscapeLeft 67 | UIInterfaceOrientationLandscapeRight 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /SmarTAG/Model/Configuration.swift: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 STMicroelectronics – All rights reserved 3 | * The STMicroelectronics corporate logo is a trademark of STMicroelectronics 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, this list of conditions 9 | * and the following disclaimer. 10 | * 11 | * - Redistributions in binary form must reproduce the above copyright notice, this list of 12 | * conditions and the following disclaimer in the documentation and/or other materials provided 13 | * with the distribution. 14 | * 15 | * - Neither the name nor trademarks of STMicroelectronics International N.V. nor any other 16 | * STMicroelectronics company nor the names of its contributors may be used to endorse or 17 | * promote products derived from this software without specific prior written permission. 18 | * 19 | * - All of the icons, pictures, logos and other images that are provided with the source code 20 | * in a directory whose title begins with st_images may only be used for internal purposes and 21 | * shall not be redistributed to any third party or modified in any way. 22 | * 23 | * - Any redistributions in binary form shall not include the capability to display any of the 24 | * icons, pictures, logos and other images that are provided with the source code in a directory 25 | * whose title begins with st_images. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 28 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 29 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 30 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 32 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 34 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 35 | * OF SUCH DAMAGE. 36 | */ 37 | import Foundation 38 | 39 | public struct Configuration{ 40 | 41 | public enum SamplingMode:UInt8{ 42 | case Inactive=0x00 43 | case Sampling=0x01 44 | case SingleShot=0x02 45 | case SamplingWithThreshold = 0x03 46 | case StoreNextSample = 0x04 47 | } 48 | 49 | public let samplingInterval_s:UInt16 50 | public let mode:SamplingMode 51 | public let temperatureConf:SensorConfiguration 52 | public let humidityConf:SensorConfiguration 53 | public let pressureConf:SensorConfiguration 54 | public let accelerometerConf:SensorConfiguration 55 | public let orientationConf:SensorConfiguration 56 | public let wakeUpConf:SensorConfiguration 57 | 58 | 59 | init(samplingInteval:UInt16,mode:SamplingMode, 60 | temperatureConf:SensorConfiguration, 61 | humidityConf:SensorConfiguration, 62 | pressureConf:SensorConfiguration, 63 | accelerometerConf:SensorConfiguration, 64 | orientationConf:SensorConfiguration, 65 | wakeUpConf:SensorConfiguration 66 | ) { 67 | samplingInterval_s = samplingInteval; 68 | self.mode = mode; 69 | self.temperatureConf = temperatureConf 70 | self.humidityConf = humidityConf 71 | self.pressureConf = pressureConf 72 | self.accelerometerConf = accelerometerConf 73 | self.orientationConf = orientationConf 74 | self.wakeUpConf = wakeUpConf 75 | } 76 | } 77 | 78 | public struct Threshold{ 79 | public let max:Float? 80 | public let min:Float? 81 | 82 | init(max:Float?,min:Float?) { 83 | self.max = max; 84 | self.min = min; 85 | } 86 | } 87 | 88 | public struct SensorConfiguration{ 89 | public let isEnable:Bool 90 | public let threshold:Threshold 91 | 92 | init(isEnable:Bool, threshold:Threshold) { 93 | self.isEnable=isEnable 94 | self.threshold = threshold 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /SmarTAG/Model/DateExtreme.swift: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 STMicroelectronics – All rights reserved 3 | * The STMicroelectronics corporate logo is a trademark of STMicroelectronics 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, this list of conditions 9 | * and the following disclaimer. 10 | * 11 | * - Redistributions in binary form must reproduce the above copyright notice, this list of 12 | * conditions and the following disclaimer in the documentation and/or other materials provided 13 | * with the distribution. 14 | * 15 | * - Neither the name nor trademarks of STMicroelectronics International N.V. nor any other 16 | * STMicroelectronics company nor the names of its contributors may be used to endorse or 17 | * promote products derived from this software without specific prior written permission. 18 | * 19 | * - All of the icons, pictures, logos and other images that are provided with the source code 20 | * in a directory whose title begins with st_images may only be used for internal purposes and 21 | * shall not be redistributed to any third party or modified in any way. 22 | * 23 | * - Any redistributions in binary form shall not include the capability to display any of the 24 | * icons, pictures, logos and other images that are provided with the source code in a directory 25 | * whose title begins with st_images. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 28 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 29 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 30 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 32 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 34 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 35 | * OF SUCH DAMAGE. 36 | */ 37 | 38 | import Foundation 39 | 40 | public struct DataExtreme{ 41 | public let minDate:Date? 42 | public let minValue:Float? 43 | public let maxDate:Date? 44 | public let maxValue:Float? 45 | 46 | init(maxDate:Date?,maxValue:Float?,minDate:Date?,minValue:Float?) { 47 | self.maxDate = maxDate 48 | self.maxValue = maxValue 49 | self.minDate = minDate 50 | self.minValue = minValue 51 | } 52 | 53 | } 54 | 55 | public struct TagExtreme{ 56 | public let acquisitionStart:Date 57 | public let temperature:DataExtreme? 58 | public let pressure:DataExtreme? 59 | public let humidity:DataExtreme? 60 | public let acceleration:DataExtreme? 61 | 62 | init(acquisitionStart:Date, temperature:DataExtreme?, 63 | pressure:DataExtreme?, humidity:DataExtreme?, acceleration:DataExtreme?) { 64 | self.acquisitionStart = acquisitionStart 65 | self.temperature = temperature 66 | self.pressure = pressure 67 | self.humidity = humidity 68 | self.acceleration = acceleration 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /SmarTAG/Model/SensorSample.swift: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 STMicroelectronics – All rights reserved 3 | * The STMicroelectronics corporate logo is a trademark of STMicroelectronics 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, this list of conditions 9 | * and the following disclaimer. 10 | * 11 | * - Redistributions in binary form must reproduce the above copyright notice, this list of 12 | * conditions and the following disclaimer in the documentation and/or other materials provided 13 | * with the distribution. 14 | * 15 | * - Neither the name nor trademarks of STMicroelectronics International N.V. nor any other 16 | * STMicroelectronics company nor the names of its contributors may be used to endorse or 17 | * promote products derived from this software without specific prior written permission. 18 | * 19 | * - All of the icons, pictures, logos and other images that are provided with the source code 20 | * in a directory whose title begins with st_images may only be used for internal purposes and 21 | * shall not be redistributed to any third party or modified in any way. 22 | * 23 | * - Any redistributions in binary form shall not include the capability to display any of the 24 | * icons, pictures, logos and other images that are provided with the source code in a directory 25 | * whose title begins with st_images. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 28 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 29 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 30 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 32 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 34 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 35 | * OF SUCH DAMAGE. 36 | */ 37 | 38 | import Foundation 39 | 40 | public enum AccelerationEvent : UInt8 { 41 | case wakeUp = 0x01 42 | case orientation = 0x02 43 | case singleTap = 0x04 44 | case doubleTap = 0x08 45 | case freeFall = 0x10 46 | case tilt = 0x20 47 | 48 | } 49 | 50 | extension UInt8 { 51 | public func toAccelerationEvents()->[AccelerationEvent]{ 52 | var events:[AccelerationEvent] = []; 53 | for i in 0...7 { 54 | let mask = UInt8(1<Orientation{ 76 | return Orientation(rawValue:self) ?? .unknown; 77 | } 78 | } 79 | 80 | public struct EventDataSample{ 81 | public let date:Date 82 | public let acceleration:Float? 83 | public let accelerationEvents:[AccelerationEvent] 84 | public let currentOrientation:Orientation 85 | } 86 | 87 | public struct SensorDataSample{ 88 | public let date:Date 89 | public let temperature:Float? 90 | public let humidity:Float? 91 | public let pressure:Float? 92 | public let acceleration:Float? 93 | 94 | init(date:Date,temperature:Float?, humidity:Float?, pressure:Float?, acceleration:Float?) { 95 | self.date = date 96 | self.temperature = temperature 97 | self.humidity = humidity 98 | self.pressure = pressure 99 | self.acceleration = acceleration 100 | } 101 | } 102 | 103 | public enum DataSample{ 104 | case sensor(data:SensorDataSample) 105 | case event(data:EventDataSample) 106 | } 107 | -------------------------------------------------------------------------------- /SmarTAG/Model/Version.swift: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 STMicroelectronics – All rights reserved 3 | * The STMicroelectronics corporate logo is a trademark of STMicroelectronics 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, this list of conditions 9 | * and the following disclaimer. 10 | * 11 | * - Redistributions in binary form must reproduce the above copyright notice, this list of 12 | * conditions and the following disclaimer in the documentation and/or other materials provided 13 | * with the distribution. 14 | * 15 | * - Neither the name nor trademarks of STMicroelectronics International N.V. nor any other 16 | * STMicroelectronics company nor the names of its contributors may be used to endorse or 17 | * promote products derived from this software without specific prior written permission. 18 | * 19 | * - All of the icons, pictures, logos and other images that are provided with the source code 20 | * in a directory whose title begins with st_images may only be used for internal purposes and 21 | * shall not be redistributed to any third party or modified in any way. 22 | * 23 | * - Any redistributions in binary form shall not include the capability to display any of the 24 | * icons, pictures, logos and other images that are provided with the source code in a directory 25 | * whose title begins with st_images. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 28 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 29 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 30 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 32 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 34 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 35 | * OF SUCH DAMAGE. 36 | */ 37 | import Foundation 38 | 39 | public struct Version{ 40 | public let majour:UInt8 41 | public let minor:UInt8 42 | public let patch:UInt8 43 | 44 | init(majour:UInt8,minor:UInt8,patch:UInt8){ 45 | self.majour = majour; 46 | self.minor = minor; 47 | self.patch = patch; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /SmarTAG/STTheme.swift: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 STMicroelectronics – All rights reserved 3 | * The STMicroelectronics corporate logo is a trademark of STMicroelectronics 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, this list of conditions 9 | * and the following disclaimer. 10 | * 11 | * - Redistributions in binary form must reproduce the above copyright notice, this list of 12 | * conditions and the following disclaimer in the documentation and/or other materials provided 13 | * with the distribution. 14 | * 15 | * - Neither the name nor trademarks of STMicroelectronics International N.V. nor any other 16 | * STMicroelectronics company nor the names of its contributors may be used to endorse or 17 | * promote products derived from this software without specific prior written permission. 18 | * 19 | * - All of the icons, pictures, logos and other images that are provided with the source code 20 | * in a directory whose title begins with st_images may only be used for internal purposes and 21 | * shall not be redistributed to any third party or modified in any way. 22 | * 23 | * - Any redistributions in binary form shall not include the capability to display any of the 24 | * icons, pictures, logos and other images that are provided with the source code in a directory 25 | * whose title begins with st_images. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 28 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 29 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 30 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 32 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 34 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 35 | * OF SUCH DAMAGE. 36 | */ 37 | import Foundation 38 | 39 | import UIKit 40 | 41 | class STTheme{ 42 | 43 | //0x39A9DC 44 | static let primaryColor = UIColor(red: 0x39/255.0, green: 0xA9/255.0, blue: 0xDC/255.0, alpha: 1.0) 45 | //0x002052 46 | static let primaryDarkColor = UIColor(red: 0x00/255.0, green: 0x20/255.0, blue: 0x52/255.0, alpha: 1.0) 47 | //D4007A 48 | static let accentColor = UIColor(red: 0xD4/255.0, green: 0x00/255.0, blue: 0x7A/255.0, alpha: 1.0) 49 | 50 | static func applayAll(){ 51 | applyUINavigatorBarTheme(UINavigationBar.appearance()) 52 | applyTabBarTheme(UITabBar.appearance()) 53 | applyButtonTheme(UIButton.appearance()) 54 | } 55 | 56 | public static func applyUINavigatorBarTheme(_ navigatiorBar: UINavigationBar){ 57 | navigatiorBar.barTintColor = primaryColor 58 | navigatiorBar.tintColor = primaryDarkColor 59 | 60 | navigatiorBar.titleTextAttributes = [ 61 | .foregroundColor : [primaryColor] 62 | ] 63 | 64 | let navigationBarButton = UIButton.appearance(whenContainedInInstancesOf: [UINavigationBar.self] ) 65 | navigationBarButton.tintColor = primaryDarkColor 66 | navigationBarButton.setTitleColor(primaryDarkColor, for: .normal) 67 | } 68 | 69 | public static func applyTabBarTheme(_ tabBar: UITabBar){ 70 | tabBar.barTintColor = primaryColor 71 | tabBar.tintColor = primaryDarkColor 72 | tabBar.unselectedItemTintColor = UIColor.white 73 | } 74 | 75 | public static func applyButtonTheme(_ button: UIButton ){ 76 | button.tintColor = accentColor 77 | button.setTitleColor(accentColor, for: .normal) 78 | } 79 | 80 | } 81 | -------------------------------------------------------------------------------- /SmarTAG/Settings/CloseKeyboardOnReturn.swift: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 STMicroelectronics – All rights reserved 3 | * The STMicroelectronics corporate logo is a trademark of STMicroelectronics 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, this list of conditions 9 | * and the following disclaimer. 10 | * 11 | * - Redistributions in binary form must reproduce the above copyright notice, this list of 12 | * conditions and the following disclaimer in the documentation and/or other materials provided 13 | * with the distribution. 14 | * 15 | * - Neither the name nor trademarks of STMicroelectronics International N.V. nor any other 16 | * STMicroelectronics company nor the names of its contributors may be used to endorse or 17 | * promote products derived from this software without specific prior written permission. 18 | * 19 | * - All of the icons, pictures, logos and other images that are provided with the source code 20 | * in a directory whose title begins with st_images may only be used for internal purposes and 21 | * shall not be redistributed to any third party or modified in any way. 22 | * 23 | * - Any redistributions in binary form shall not include the capability to display any of the 24 | * icons, pictures, logos and other images that are provided with the source code in a directory 25 | * whose title begins with st_images. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 28 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 29 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 30 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 32 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 34 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 35 | * OF SUCH DAMAGE. 36 | */ 37 | 38 | import Foundation 39 | import UIKit 40 | 41 | internal class CloseKeyboardOnReturn : NSObject, UITextFieldDelegate{ 42 | 43 | public func textFieldShouldReturn(_ textField: UITextField) -> Bool { 44 | textField.resignFirstResponder() 45 | return false 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /SmarTAG/Settings/SmarTagAccelerationSettingCell.swift: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 STMicroelectronics – All rights reserved 3 | * The STMicroelectronics corporate logo is a trademark of STMicroelectronics 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, this list of conditions 9 | * and the following disclaimer. 10 | * 11 | * - Redistributions in binary form must reproduce the above copyright notice, this list of 12 | * conditions and the following disclaimer in the documentation and/or other materials provided 13 | * with the distribution. 14 | * 15 | * - Neither the name nor trademarks of STMicroelectronics International N.V. nor any other 16 | * STMicroelectronics company nor the names of its contributors may be used to endorse or 17 | * promote products derived from this software without specific prior written permission. 18 | * 19 | * - All of the icons, pictures, logos and other images that are provided with the source code 20 | * in a directory whose title begins with st_images may only be used for internal purposes and 21 | * shall not be redistributed to any third party or modified in any way. 22 | * 23 | * - Any redistributions in binary form shall not include the capability to display any of the 24 | * icons, pictures, logos and other images that are provided with the source code in a directory 25 | * whose title begins with st_images. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 28 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 29 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 30 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 32 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 34 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 35 | * OF SUCH DAMAGE. 36 | */ 37 | 38 | import Foundation 39 | import UIKit 40 | import SmarTagLib 41 | 42 | class SmarTagAccelerationSettingCell : SmarTagThresholdSensorCell{ 43 | 44 | public struct Data : SmarTagThresholdSensorCellData{ 45 | public let name: String 46 | public let unit: String 47 | public let dataFormat: String 48 | public let image: UIImage 49 | public let sensorConf: SensorConfiguration 50 | public let orientationEnabled:Bool 51 | public let wakeUpEnabled:Bool 52 | } 53 | 54 | @IBOutlet weak var mWakeUpSwitch: UISwitch! 55 | @IBOutlet weak var mOrientaitonSwitch: UISwitch! 56 | @IBOutlet weak var mOrientationView: UIView! 57 | @IBOutlet weak var mWakeUpView: UIView! 58 | 59 | public func setData(data:SmarTagAccelerationSettingCell.Data, isEditable:Bool){ 60 | super.setData(data: data,isEditable: isEditable) 61 | mOrientaitonSwitch.isOn = data.orientationEnabled 62 | mOrientaitonSwitch.isEnabled = isEditable 63 | mWakeUpSwitch.isOn = data.wakeUpEnabled 64 | mWakeUpSwitch.isEnabled = isEditable 65 | } 66 | 67 | public override func hideThreshold(_ isHide:Bool){ 68 | super.hideThreshold(isHide) 69 | mOrientationView.isHidden = isHide 70 | mWakeUpView.isHidden = isHide 71 | } 72 | 73 | @IBAction func onOrientationEnableStatusChange(switch:UISwitch){ 74 | onSettingsChange?(self) 75 | } 76 | 77 | @IBAction func onWakeUpEnableStatusChange(switch:UISwitch){ 78 | onSettingsChange?(self) 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /SmarTAG/Settings/SmarTagSensorSettingCell.swift: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 STMicroelectronics – All rights reserved 3 | * The STMicroelectronics corporate logo is a trademark of STMicroelectronics 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, this list of conditions 9 | * and the following disclaimer. 10 | * 11 | * - Redistributions in binary form must reproduce the above copyright notice, this list of 12 | * conditions and the following disclaimer in the documentation and/or other materials provided 13 | * with the distribution. 14 | * 15 | * - Neither the name nor trademarks of STMicroelectronics International N.V. nor any other 16 | * STMicroelectronics company nor the names of its contributors may be used to endorse or 17 | * promote products derived from this software without specific prior written permission. 18 | * 19 | * - All of the icons, pictures, logos and other images that are provided with the source code 20 | * in a directory whose title begins with st_images may only be used for internal purposes and 21 | * shall not be redistributed to any third party or modified in any way. 22 | * 23 | * - Any redistributions in binary form shall not include the capability to display any of the 24 | * icons, pictures, logos and other images that are provided with the source code in a directory 25 | * whose title begins with st_images. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 28 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 29 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 30 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 32 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 34 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 35 | * OF SUCH DAMAGE. 36 | */ 37 | 38 | import Foundation 39 | import UIKit 40 | import SmarTagLib 41 | 42 | class SmarTagSensorSettingCell : SmarTagThresholdSensorCell{ 43 | 44 | @IBOutlet weak var mMinView: UIStackView! 45 | @IBOutlet weak var mMinThText: UITextField! 46 | @IBOutlet weak var mMinUnitText: UILabel! 47 | 48 | public struct Data: SmarTagThresholdSensorCellData{ 49 | public let name: String 50 | public let unit: String 51 | public let dataFormat: String 52 | public let image: UIImage 53 | public let sensorConf: SensorConfiguration 54 | } 55 | 56 | public func setData(data:SmarTagSensorSettingCell.Data, isEditable:Bool){ 57 | super.setData(data:data,isEditable: isEditable) 58 | mMinUnitText.text = data.unit 59 | if let min = data.sensorConf.threshold.min{ 60 | mMinThText.text=String(format: data.dataFormat, min) 61 | mMinThText.isEnabled = isEditable 62 | }else{ 63 | mMinView.isHidden=true 64 | } 65 | } 66 | 67 | public override func hideThreshold(_ isHide:Bool){ 68 | super.hideThreshold(isHide) 69 | mMinView.isHidden=isHide 70 | } 71 | 72 | @IBAction func onMinThChange( text:UITextField){ 73 | onSettingsChange?(self) 74 | } 75 | 76 | } 77 | -------------------------------------------------------------------------------- /SmarTAG/Settings/SmarTagThresholdSensorCell.swift: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 STMicroelectronics – All rights reserved 3 | * The STMicroelectronics corporate logo is a trademark of STMicroelectronics 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, this list of conditions 9 | * and the following disclaimer. 10 | * 11 | * - Redistributions in binary form must reproduce the above copyright notice, this list of 12 | * conditions and the following disclaimer in the documentation and/or other materials provided 13 | * with the distribution. 14 | * 15 | * - Neither the name nor trademarks of STMicroelectronics International N.V. nor any other 16 | * STMicroelectronics company nor the names of its contributors may be used to endorse or 17 | * promote products derived from this software without specific prior written permission. 18 | * 19 | * - All of the icons, pictures, logos and other images that are provided with the source code 20 | * in a directory whose title begins with st_images may only be used for internal purposes and 21 | * shall not be redistributed to any third party or modified in any way. 22 | * 23 | * - Any redistributions in binary form shall not include the capability to display any of the 24 | * icons, pictures, logos and other images that are provided with the source code in a directory 25 | * whose title begins with st_images. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 28 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 29 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 30 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 32 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 34 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 35 | * OF SUCH DAMAGE. 36 | */ 37 | 38 | import UIKit 39 | import SmarTagLib 40 | 41 | public protocol SmarTagThresholdSensorCellData{ 42 | var name:String {get} 43 | var unit:String {get} 44 | var dataFormat:String {get} 45 | var image:UIImage {get} 46 | var sensorConf:SensorConfiguration {get} 47 | } 48 | 49 | open class SmarTagThresholdSensorCell : UITableViewCell{ 50 | 51 | @IBOutlet weak var mImage: UIImageView! 52 | @IBOutlet weak var mName: UILabel! 53 | @IBOutlet weak var mEnable: UISwitch! 54 | 55 | @IBOutlet weak var mMaxThText: UITextField! 56 | @IBOutlet weak var mMaxUnitText: UILabel! 57 | @IBOutlet weak var mMaxView: UIStackView! 58 | 59 | public var showThresholdDelegate: (() -> Bool)?; 60 | public var onSettingsChange:((SmarTagThresholdSensorCell)->Void)? 61 | 62 | public func setData(data:SmarTagThresholdSensorCellData, isEditable:Bool){ 63 | mName.text = data.name 64 | mImage.image = data.image 65 | mEnable.isOn = data.sensorConf.isEnable 66 | mEnable.isEnabled = isEditable 67 | mMaxUnitText.text = data.unit 68 | hideThreshold(!((showThresholdDelegate?() ?? false) && data.sensorConf.isEnable)) 69 | 70 | if let max = data.sensorConf.threshold.max{ 71 | mMaxThText.text=String(format: data.dataFormat, max) 72 | mEnable.isEnabled = isEditable 73 | }else{ 74 | mMaxView.isHidden=true 75 | } 76 | 77 | } 78 | 79 | public func hideThreshold(_ isHide:Bool){ 80 | mMaxView.isHidden=isHide 81 | } 82 | 83 | @IBAction func onEnableStatusChange( switch:UISwitch){ 84 | onSettingsChange?(self) 85 | } 86 | 87 | @IBAction func onMaxThChange( text:UITextField){ 88 | onSettingsChange?(self) 89 | } 90 | 91 | 92 | } 93 | -------------------------------------------------------------------------------- /SmarTAG/Settings/String+floatOrNil.swift: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 STMicroelectronics – All rights reserved 3 | * The STMicroelectronics corporate logo is a trademark of STMicroelectronics 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, this list of conditions 9 | * and the following disclaimer. 10 | * 11 | * - Redistributions in binary form must reproduce the above copyright notice, this list of 12 | * conditions and the following disclaimer in the documentation and/or other materials provided 13 | * with the distribution. 14 | * 15 | * - Neither the name nor trademarks of STMicroelectronics International N.V. nor any other 16 | * STMicroelectronics company nor the names of its contributors may be used to endorse or 17 | * promote products derived from this software without specific prior written permission. 18 | * 19 | * - All of the icons, pictures, logos and other images that are provided with the source code 20 | * in a directory whose title begins with st_images may only be used for internal purposes and 21 | * shall not be redistributed to any third party or modified in any way. 22 | * 23 | * - Any redistributions in binary form shall not include the capability to display any of the 24 | * icons, pictures, logos and other images that are provided with the source code in a directory 25 | * whose title begins with st_images. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 28 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 29 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 30 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 32 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 34 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 35 | * OF SUCH DAMAGE. 36 | */ 37 | 38 | import Foundation 39 | // MARK: String? 40 | 41 | internal extension Optional where Wrapped == String { 42 | 43 | /// convert the string value to float or return nil 44 | var floatOrNil:Float?{ 45 | guard let value = self else{ 46 | return nil 47 | } 48 | return Float(value) 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /SmarTAG/ShowData/SmarTagSensorDetailsViewController.swift: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 STMicroelectronics – All rights reserved 3 | * The STMicroelectronics corporate logo is a trademark of STMicroelectronics 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, this list of conditions 9 | * and the following disclaimer. 10 | * 11 | * - Redistributions in binary form must reproduce the above copyright notice, this list of 12 | * conditions and the following disclaimer in the documentation and/or other materials provided 13 | * with the distribution. 14 | * 15 | * - Neither the name nor trademarks of STMicroelectronics International N.V. nor any other 16 | * STMicroelectronics company nor the names of its contributors may be used to endorse or 17 | * promote products derived from this software without specific prior written permission. 18 | * 19 | * - All of the icons, pictures, logos and other images that are provided with the source code 20 | * in a directory whose title begins with st_images may only be used for internal purposes and 21 | * shall not be redistributed to any third party or modified in any way. 22 | * 23 | * - Any redistributions in binary form shall not include the capability to display any of the 24 | * icons, pictures, logos and other images that are provided with the source code in a directory 25 | * whose title begins with st_images. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 28 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 29 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 30 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 32 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 34 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 35 | * OF SUCH DAMAGE. 36 | */ 37 | import Foundation 38 | import UIKit 39 | import Charts 40 | 41 | /// <#Description#> 42 | public class SmarTagSensorDetailsViewController : UIViewController { 43 | 44 | public struct Data{ 45 | let title:String 46 | let dataFormat:String 47 | let samples:[ChartDataEntry] 48 | } 49 | 50 | public var data:Data?=nil; 51 | 52 | @IBOutlet weak var mTitle: UILabel! 53 | @IBOutlet weak var mDetailsTable: UITableView! 54 | 55 | public override func viewDidLoad() { 56 | mDetailsTable.dataSource = self; 57 | } 58 | 59 | public override func viewWillAppear(_ animated: Bool) { 60 | mTitle.text = data?.title 61 | mDetailsTable.reloadData() 62 | } 63 | 64 | } 65 | 66 | 67 | extension SmarTagSensorDetailsViewController : UITableViewDataSource{ 68 | private static let CELL_ID = "SmarTagSensorDetailsViewCell" 69 | static let DATE_FORMAT : DateFormatter = { 70 | let formatter = DateFormatter(); 71 | formatter.dateFormat = "HH:mm:ss dd/MMM/YY" 72 | return formatter; 73 | }(); 74 | 75 | public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 76 | return data?.samples.count ?? 0 77 | } 78 | 79 | public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 80 | let cell = tableView.dequeueReusableCell(withIdentifier:SmarTagSensorDetailsViewController.CELL_ID)! 81 | 82 | if let entry = data?.samples[indexPath.row], 83 | let format = data?.dataFormat{ 84 | cell.detailTextLabel?.text = String(format:format,entry.y) 85 | let date = Date(timeIntervalSinceReferenceDate: entry.x) 86 | cell.textLabel?.text = SmarTagSensorDetailsViewController.DATE_FORMAT.string(from: date) 87 | } 88 | 89 | return cell 90 | 91 | } 92 | 93 | 94 | 95 | 96 | } 97 | -------------------------------------------------------------------------------- /SmarTAG/SmarTAG.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.developer.nfc.readersession.formats 6 | 7 | NDEF 8 | TAG 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /SmarTAG/SmarTag/SmarTagNDefParserProtocol.swift: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 STMicroelectronics – All rights reserved 3 | * The STMicroelectronics corporate logo is a trademark of STMicroelectronics 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, this list of conditions 9 | * and the following disclaimer. 10 | * 11 | * - Redistributions in binary form must reproduce the above copyright notice, this list of 12 | * conditions and the following disclaimer in the documentation and/or other materials provided 13 | * with the distribution. 14 | * 15 | * - Neither the name nor trademarks of STMicroelectronics International N.V. nor any other 16 | * STMicroelectronics company nor the names of its contributors may be used to endorse or 17 | * promote products derived from this software without specific prior written permission. 18 | * 19 | * - All of the icons, pictures, logos and other images that are provided with the source code 20 | * in a directory whose title begins with st_images may only be used for internal purposes and 21 | * shall not be redistributed to any third party or modified in any way. 22 | * 23 | * - Any redistributions in binary form shall not include the capability to display any of the 24 | * icons, pictures, logos and other images that are provided with the source code in a directory 25 | * whose title begins with st_images. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 28 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 29 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 30 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 32 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 34 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 35 | * OF SUCH DAMAGE. 36 | */ 37 | 38 | import Foundation 39 | 40 | public enum SmarTagError : Error{ 41 | case InvalidVersion 42 | } 43 | 44 | public protocol SmarTagNdefParserPotocol{ 45 | 46 | var version:Version { get } 47 | var configuration:Configuration { get } 48 | var samples:[DataSample] { get } 49 | var dataExtreme:TagExtreme { get } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /SmarTAG/StarTagObjectWithTag.swift: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 STMicroelectronics – All rights reserved 3 | * The STMicroelectronics corporate logo is a trademark of STMicroelectronics 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, this list of conditions 9 | * and the following disclaimer. 10 | * 11 | * - Redistributions in binary form must reproduce the above copyright notice, this list of 12 | * conditions and the following disclaimer in the documentation and/or other materials provided 13 | * with the distribution. 14 | * 15 | * - Neither the name nor trademarks of STMicroelectronics International N.V. nor any other 16 | * STMicroelectronics company nor the names of its contributors may be used to endorse or 17 | * promote products derived from this software without specific prior written permission. 18 | * 19 | * - All of the icons, pictures, logos and other images that are provided with the source code 20 | * in a directory whose title begins with st_images may only be used for internal purposes and 21 | * shall not be redistributed to any third party or modified in any way. 22 | * 23 | * - Any redistributions in binary form shall not include the capability to display any of the 24 | * icons, pictures, logos and other images that are provided with the source code in a directory 25 | * whose title begins with st_images. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 28 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 29 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 30 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 32 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 34 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 35 | * OF SUCH DAMAGE. 36 | */ 37 | 38 | import SmarTagLib 39 | 40 | protocol SmarTagObjectWithTag { 41 | var tagContent:SmarTagData? {get set} 42 | } 43 | 44 | extension SmarTagObjectWithTag{ 45 | public func propagateTagContentTo(_ object:Any){ 46 | if var objectWithTag = object as? SmarTagObjectWithTag{ 47 | objectWithTag.tagContent = tagContent; 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /SmarTAG/Util/UIViewControllerExt.swift: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 STMicroelectronics – All rights reserved 3 | * The STMicroelectronics corporate logo is a trademark of STMicroelectronics 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, this list of conditions 9 | * and the following disclaimer. 10 | * 11 | * - Redistributions in binary form must reproduce the above copyright notice, this list of 12 | * conditions and the following disclaimer in the documentation and/or other materials provided 13 | * with the distribution. 14 | * 15 | * - Neither the name nor trademarks of STMicroelectronics International N.V. nor any other 16 | * STMicroelectronics company nor the names of its contributors may be used to endorse or 17 | * promote products derived from this software without specific prior written permission. 18 | * 19 | * - All of the icons, pictures, logos and other images that are provided with the source code 20 | * in a directory whose title begins with st_images may only be used for internal purposes and 21 | * shall not be redistributed to any third party or modified in any way. 22 | * 23 | * - Any redistributions in binary form shall not include the capability to display any of the 24 | * icons, pictures, logos and other images that are provided with the source code in a directory 25 | * whose title begins with st_images. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 28 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 29 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 30 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 32 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 34 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 35 | * OF SUCH DAMAGE. 36 | */ 37 | 38 | import Foundation 39 | import UIKit 40 | 41 | extension UIViewController{ 42 | 43 | public func showErrorMessage(title:String, message:String, onButtonPressed:((UIAlertController)->Void)?=nil){ 44 | 45 | let alertController = UIAlertController(title: title, message: message, preferredStyle: .alert) 46 | 47 | let defaultAction = UIAlertAction(title: "Ok", style: .destructive){ action in 48 | if(onButtonPressed != nil){ 49 | onButtonPressed!(alertController) 50 | }else{ 51 | alertController.dismiss(animated: true, completion: nil) 52 | } 53 | } 54 | alertController.addAction(defaultAction) 55 | present(alertController, animated: true, completion: nil) 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /SmarTAG/about.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 37 | 38 | 39 |

ST SmarTag application to be used with STMicroelectronics FP-SNS-SMARTAG1 compatible firmware. 40 |

41 |

For further information visit this page

42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /SmarTAG/images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /SmarTAG/images.xcassets/menu_icon.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "demo_menu_icon.pdf" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | } 12 | } -------------------------------------------------------------------------------- /SmarTAG/images.xcassets/menu_icon.imageset/demo_menu_icon.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STMicroelectronics/STNFCSensor_iOS/9d87da75e6b944bfbf44ca8bbd83c582c042cdcf/SmarTAG/images.xcassets/menu_icon.imageset/demo_menu_icon.pdf -------------------------------------------------------------------------------- /SmarTAG/images.xcassets/settings_icon.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "settings_icon.pdf" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | } 12 | } -------------------------------------------------------------------------------- /SmarTAG/images.xcassets/settings_icon.imageset/settings_icon.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STMicroelectronics/STNFCSensor_iOS/9d87da75e6b944bfbf44ca8bbd83c582c042cdcf/SmarTAG/images.xcassets/settings_icon.imageset/settings_icon.pdf -------------------------------------------------------------------------------- /SmarTAG/images_svg/alert-circle-outline.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /SmarTAG/images_svg/settings.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /SmarTAG/images_svg/show_data.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/AboutButton.imageset/AboutButton.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STMicroelectronics/STNFCSensor_iOS/9d87da75e6b944bfbf44ca8bbd83c582c042cdcf/SmarTAG/st_images.xcassets/AboutButton.imageset/AboutButton.pdf -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/AboutButton.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "AboutButton.pdf" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | }, 12 | "properties" : { 13 | "preserves-vector-representation" : true 14 | } 15 | } -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-Small-42.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-60.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-Small@2x.png", 19 | "scale" : "2x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-Small@3x.png", 25 | "scale" : "3x" 26 | }, 27 | { 28 | "size" : "40x40", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-Small-40@2x-1.png", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-Small-40@3x.png", 37 | "scale" : "3x" 38 | }, 39 | { 40 | "size" : "60x60", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-60@2x.png", 43 | "scale" : "2x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-60@3x.png", 49 | "scale" : "3x" 50 | }, 51 | { 52 | "size" : "20x20", 53 | "idiom" : "ipad", 54 | "filename" : "Icon-20.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-Small-41.png", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "size" : "29x29", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-Small.png", 67 | "scale" : "1x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-Small@2x-1.png", 73 | "scale" : "2x" 74 | }, 75 | { 76 | "size" : "40x40", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-Small-40.png", 79 | "scale" : "1x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-Small-40@2x.png", 85 | "scale" : "2x" 86 | }, 87 | { 88 | "size" : "76x76", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-76.png", 91 | "scale" : "1x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-76@2x.png", 97 | "scale" : "2x" 98 | }, 99 | { 100 | "size" : "83.5x83.5", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-167.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "1024x1024", 107 | "idiom" : "ios-marketing", 108 | "filename" : "iTunesArtwork@2x.png", 109 | "scale" : "1x" 110 | } 111 | ], 112 | "info" : { 113 | "version" : 1, 114 | "author" : "xcode" 115 | } 116 | } -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/AppIcon.appiconset/Icon-167.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STMicroelectronics/STNFCSensor_iOS/9d87da75e6b944bfbf44ca8bbd83c582c042cdcf/SmarTAG/st_images.xcassets/AppIcon.appiconset/Icon-167.png -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/AppIcon.appiconset/Icon-20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STMicroelectronics/STNFCSensor_iOS/9d87da75e6b944bfbf44ca8bbd83c582c042cdcf/SmarTAG/st_images.xcassets/AppIcon.appiconset/Icon-20.png -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/AppIcon.appiconset/Icon-60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STMicroelectronics/STNFCSensor_iOS/9d87da75e6b944bfbf44ca8bbd83c582c042cdcf/SmarTAG/st_images.xcassets/AppIcon.appiconset/Icon-60.png -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/AppIcon.appiconset/Icon-60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STMicroelectronics/STNFCSensor_iOS/9d87da75e6b944bfbf44ca8bbd83c582c042cdcf/SmarTAG/st_images.xcassets/AppIcon.appiconset/Icon-60@2x.png -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/AppIcon.appiconset/Icon-60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STMicroelectronics/STNFCSensor_iOS/9d87da75e6b944bfbf44ca8bbd83c582c042cdcf/SmarTAG/st_images.xcassets/AppIcon.appiconset/Icon-60@3x.png -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/AppIcon.appiconset/Icon-76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STMicroelectronics/STNFCSensor_iOS/9d87da75e6b944bfbf44ca8bbd83c582c042cdcf/SmarTAG/st_images.xcassets/AppIcon.appiconset/Icon-76.png -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/AppIcon.appiconset/Icon-76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STMicroelectronics/STNFCSensor_iOS/9d87da75e6b944bfbf44ca8bbd83c582c042cdcf/SmarTAG/st_images.xcassets/AppIcon.appiconset/Icon-76@2x.png -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/AppIcon.appiconset/Icon-Small-40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STMicroelectronics/STNFCSensor_iOS/9d87da75e6b944bfbf44ca8bbd83c582c042cdcf/SmarTAG/st_images.xcassets/AppIcon.appiconset/Icon-Small-40.png -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/AppIcon.appiconset/Icon-Small-40@2x-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STMicroelectronics/STNFCSensor_iOS/9d87da75e6b944bfbf44ca8bbd83c582c042cdcf/SmarTAG/st_images.xcassets/AppIcon.appiconset/Icon-Small-40@2x-1.png -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/AppIcon.appiconset/Icon-Small-40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STMicroelectronics/STNFCSensor_iOS/9d87da75e6b944bfbf44ca8bbd83c582c042cdcf/SmarTAG/st_images.xcassets/AppIcon.appiconset/Icon-Small-40@2x.png -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/AppIcon.appiconset/Icon-Small-40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STMicroelectronics/STNFCSensor_iOS/9d87da75e6b944bfbf44ca8bbd83c582c042cdcf/SmarTAG/st_images.xcassets/AppIcon.appiconset/Icon-Small-40@3x.png -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/AppIcon.appiconset/Icon-Small-41.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STMicroelectronics/STNFCSensor_iOS/9d87da75e6b944bfbf44ca8bbd83c582c042cdcf/SmarTAG/st_images.xcassets/AppIcon.appiconset/Icon-Small-41.png -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/AppIcon.appiconset/Icon-Small-42.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STMicroelectronics/STNFCSensor_iOS/9d87da75e6b944bfbf44ca8bbd83c582c042cdcf/SmarTAG/st_images.xcassets/AppIcon.appiconset/Icon-Small-42.png -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/AppIcon.appiconset/Icon-Small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STMicroelectronics/STNFCSensor_iOS/9d87da75e6b944bfbf44ca8bbd83c582c042cdcf/SmarTAG/st_images.xcassets/AppIcon.appiconset/Icon-Small.png -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/AppIcon.appiconset/Icon-Small@2x-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STMicroelectronics/STNFCSensor_iOS/9d87da75e6b944bfbf44ca8bbd83c582c042cdcf/SmarTAG/st_images.xcassets/AppIcon.appiconset/Icon-Small@2x-1.png -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/AppIcon.appiconset/Icon-Small@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STMicroelectronics/STNFCSensor_iOS/9d87da75e6b944bfbf44ca8bbd83c582c042cdcf/SmarTAG/st_images.xcassets/AppIcon.appiconset/Icon-Small@2x.png -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/AppIcon.appiconset/Icon-Small@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STMicroelectronics/STNFCSensor_iOS/9d87da75e6b944bfbf44ca8bbd83c582c042cdcf/SmarTAG/st_images.xcassets/AppIcon.appiconset/Icon-Small@3x.png -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/AppIcon.appiconset/iTunesArtwork@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STMicroelectronics/STNFCSensor_iOS/9d87da75e6b944bfbf44ca8bbd83c582c042cdcf/SmarTAG/st_images.xcassets/AppIcon.appiconset/iTunesArtwork@2x.png -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/HarverstingButton.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "HarverstingButton.pdf" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | } 12 | } -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/HarverstingButton.imageset/HarverstingButton.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STMicroelectronics/STNFCSensor_iOS/9d87da75e6b944bfbf44ca8bbd83c582c042cdcf/SmarTAG/st_images.xcassets/HarverstingButton.imageset/HarverstingButton.pdf -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/SearchButton.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "SearchButton.pdf" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | }, 12 | "properties" : { 13 | "preserves-vector-representation" : true 14 | } 15 | } -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/SearchButton.imageset/ST_SmarTag_search_button_icon.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STMicroelectronics/STNFCSensor_iOS/9d87da75e6b944bfbf44ca8bbd83c582c042cdcf/SmarTAG/st_images.xcassets/SearchButton.imageset/ST_SmarTag_search_button_icon.pdf -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/SearchButton.imageset/SearchButton.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STMicroelectronics/STNFCSensor_iOS/9d87da75e6b944bfbf44ca8bbd83c582c042cdcf/SmarTAG/st_images.xcassets/SearchButton.imageset/SearchButton.pdf -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/about_header.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "st25Nfc.pdf" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | } 12 | } -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/about_header.imageset/st25Nfc.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STMicroelectronics/STNFCSensor_iOS/9d87da75e6b944bfbf44ca8bbd83c582c042cdcf/SmarTAG/st_images.xcassets/about_header.imageset/st25Nfc.pdf -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/alert_circle.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "alert_circle.pdf" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | } 12 | } -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/alert_circle.imageset/alert_circle.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STMicroelectronics/STNFCSensor_iOS/9d87da75e6b944bfbf44ca8bbd83c582c042cdcf/SmarTAG/st_images.xcassets/alert_circle.imageset/alert_circle.pdf -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/event_doubleTap.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "event_doubleTap.pdf" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | } 12 | } -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/event_doubleTap.imageset/event_doubleTap.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STMicroelectronics/STNFCSensor_iOS/9d87da75e6b944bfbf44ca8bbd83c582c042cdcf/SmarTAG/st_images.xcassets/event_doubleTap.imageset/event_doubleTap.pdf -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/event_freefall.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "event_freefall.pdf" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | } 12 | } -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/event_freefall.imageset/event_freefall.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STMicroelectronics/STNFCSensor_iOS/9d87da75e6b944bfbf44ca8bbd83c582c042cdcf/SmarTAG/st_images.xcassets/event_freefall.imageset/event_freefall.pdf -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/event_orientation.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "event_orientation.pdf" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | } 12 | } -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/event_orientation.imageset/event_orientation.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STMicroelectronics/STNFCSensor_iOS/9d87da75e6b944bfbf44ca8bbd83c582c042cdcf/SmarTAG/st_images.xcassets/event_orientation.imageset/event_orientation.pdf -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/event_singleTap.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "event_singleTap.pdf" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | } 12 | } -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/event_singleTap.imageset/event_singleTap.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STMicroelectronics/STNFCSensor_iOS/9d87da75e6b944bfbf44ca8bbd83c582c042cdcf/SmarTAG/st_images.xcassets/event_singleTap.imageset/event_singleTap.pdf -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/event_tilt.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "event_tilt.pdf" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | } 12 | } -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/event_tilt.imageset/event_tilt.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STMicroelectronics/STNFCSensor_iOS/9d87da75e6b944bfbf44ca8bbd83c582c042cdcf/SmarTAG/st_images.xcassets/event_tilt.imageset/event_tilt.pdf -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/event_wakeUp.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "event_wakeUp.pdf" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | } 12 | } -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/event_wakeUp.imageset/event_wakeUp.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STMicroelectronics/STNFCSensor_iOS/9d87da75e6b944bfbf44ca8bbd83c582c042cdcf/SmarTAG/st_images.xcassets/event_wakeUp.imageset/event_wakeUp.pdf -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/humidity_icon.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "humidity_icon.pdf" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | } 12 | } -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/humidity_icon.imageset/humidity_icon.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STMicroelectronics/STNFCSensor_iOS/9d87da75e6b944bfbf44ca8bbd83c582c042cdcf/SmarTAG/st_images.xcassets/humidity_icon.imageset/humidity_icon.pdf -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/orientation_bottom_left.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "orientation_bottom_left.pdf" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | } 12 | } -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/orientation_bottom_left.imageset/orientation_bottom_left.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STMicroelectronics/STNFCSensor_iOS/9d87da75e6b944bfbf44ca8bbd83c582c042cdcf/SmarTAG/st_images.xcassets/orientation_bottom_left.imageset/orientation_bottom_left.pdf -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/orientation_bottom_right.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "orientation_bottom_right.pdf" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | } 12 | } -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/orientation_bottom_right.imageset/orientation_bottom_right.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STMicroelectronics/STNFCSensor_iOS/9d87da75e6b944bfbf44ca8bbd83c582c042cdcf/SmarTAG/st_images.xcassets/orientation_bottom_right.imageset/orientation_bottom_right.pdf -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/orientation_down.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "orientation_down.pdf" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | } 12 | } -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/orientation_down.imageset/orientation_down.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STMicroelectronics/STNFCSensor_iOS/9d87da75e6b944bfbf44ca8bbd83c582c042cdcf/SmarTAG/st_images.xcassets/orientation_down.imageset/orientation_down.pdf -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/orientation_top_left.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "orientation_top_left.pdf" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | } 12 | } -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/orientation_top_left.imageset/orientation_top_left.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STMicroelectronics/STNFCSensor_iOS/9d87da75e6b944bfbf44ca8bbd83c582c042cdcf/SmarTAG/st_images.xcassets/orientation_top_left.imageset/orientation_top_left.pdf -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/orientation_top_right.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "orientation_top_right.pdf" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | } 12 | } -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/orientation_top_right.imageset/orientation_top_right.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STMicroelectronics/STNFCSensor_iOS/9d87da75e6b944bfbf44ca8bbd83c582c042cdcf/SmarTAG/st_images.xcassets/orientation_top_right.imageset/orientation_top_right.pdf -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/orientation_up.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "orientation_up.pdf" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | } 12 | } -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/orientation_up.imageset/orientation_up.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STMicroelectronics/STNFCSensor_iOS/9d87da75e6b944bfbf44ca8bbd83c582c042cdcf/SmarTAG/st_images.xcassets/orientation_up.imageset/orientation_up.pdf -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/pressure_icon.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "pressure_icon.pdf" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | } 12 | } -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/pressure_icon.imageset/pressure_icon.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STMicroelectronics/STNFCSensor_iOS/9d87da75e6b944bfbf44ca8bbd83c582c042cdcf/SmarTAG/st_images.xcassets/pressure_icon.imageset/pressure_icon.pdf -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/show_data.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "show_data.pdf" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | } 12 | } -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/show_data.imageset/show_data.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STMicroelectronics/STNFCSensor_iOS/9d87da75e6b944bfbf44ca8bbd83c582c042cdcf/SmarTAG/st_images.xcassets/show_data.imageset/show_data.pdf -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/st_accent.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | }, 6 | "colors" : [ 7 | { 8 | "idiom" : "universal", 9 | "color" : { 10 | "color-space" : "srgb", 11 | "components" : { 12 | "red" : "0xD4", 13 | "alpha" : "1.000", 14 | "blue" : "0x7A", 15 | "green" : "0x00" 16 | } 17 | } 18 | } 19 | ] 20 | } -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/st_primary.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | }, 6 | "colors" : [ 7 | { 8 | "idiom" : "universal", 9 | "color" : { 10 | "color-space" : "srgb", 11 | "components" : { 12 | "red" : "0x39", 13 | "alpha" : "1.000", 14 | "blue" : "0xDC", 15 | "green" : "0xA9" 16 | } 17 | } 18 | } 19 | ] 20 | } -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/temperature_icon.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "temperature_icon.pdf" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | } 12 | } -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/temperature_icon.imageset/temperature_icon.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STMicroelectronics/STNFCSensor_iOS/9d87da75e6b944bfbf44ca8bbd83c582c042cdcf/SmarTAG/st_images.xcassets/temperature_icon.imageset/temperature_icon.pdf -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/vibration_icon.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "vibration_icon.pdf" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | } 12 | } -------------------------------------------------------------------------------- /SmarTAG/st_images.xcassets/vibration_icon.imageset/vibration_icon.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STMicroelectronics/STNFCSensor_iOS/9d87da75e6b944bfbf44ca8bbd83c582c042cdcf/SmarTAG/st_images.xcassets/vibration_icon.imageset/vibration_icon.pdf -------------------------------------------------------------------------------- /SmarTAG/st_images_LanchScreen.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /SmarTAG/st_images_LanchScreen.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "extent" : "full-screen", 5 | "idiom" : "iphone", 6 | "subtype" : "2436h", 7 | "filename" : "STLogo.png", 8 | "minimum-system-version" : "11.0", 9 | "orientation" : "portrait", 10 | "scale" : "3x" 11 | }, 12 | { 13 | "extent" : "full-screen", 14 | "idiom" : "iphone", 15 | "subtype" : "736h", 16 | "filename" : "Launch_images_iPH6Plus_1242 x 2208 (@3x)_portrait.png", 17 | "minimum-system-version" : "8.0", 18 | "orientation" : "portrait", 19 | "scale" : "3x" 20 | }, 21 | { 22 | "extent" : "full-screen", 23 | "idiom" : "iphone", 24 | "subtype" : "736h", 25 | "filename" : "Launch_images_iPH6Plus_2208 x 1242 (@3x)_landscape.png", 26 | "minimum-system-version" : "8.0", 27 | "orientation" : "landscape", 28 | "scale" : "3x" 29 | }, 30 | { 31 | "extent" : "full-screen", 32 | "idiom" : "iphone", 33 | "subtype" : "667h", 34 | "filename" : "Launch_images_iPH6_750x1334_portrait.png", 35 | "minimum-system-version" : "8.0", 36 | "orientation" : "portrait", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "orientation" : "portrait", 41 | "idiom" : "iphone", 42 | "filename" : "Launch_images_iPH_640x960-(@2x)_portrait.png", 43 | "extent" : "full-screen", 44 | "minimum-system-version" : "7.0", 45 | "scale" : "2x" 46 | }, 47 | { 48 | "extent" : "full-screen", 49 | "idiom" : "iphone", 50 | "subtype" : "retina4", 51 | "filename" : "Launch_images_iPH_640 x 1136 (@2x)_portrait.png", 52 | "minimum-system-version" : "7.0", 53 | "orientation" : "portrait", 54 | "scale" : "2x" 55 | } 56 | ], 57 | "info" : { 58 | "version" : 1, 59 | "author" : "xcode" 60 | } 61 | } -------------------------------------------------------------------------------- /SmarTAG/st_images_LanchScreen.xcassets/LaunchImage.launchimage/Launch_images_iPH6Plus_1242 x 2208 (@3x)_portrait.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STMicroelectronics/STNFCSensor_iOS/9d87da75e6b944bfbf44ca8bbd83c582c042cdcf/SmarTAG/st_images_LanchScreen.xcassets/LaunchImage.launchimage/Launch_images_iPH6Plus_1242 x 2208 (@3x)_portrait.png -------------------------------------------------------------------------------- /SmarTAG/st_images_LanchScreen.xcassets/LaunchImage.launchimage/Launch_images_iPH6Plus_2208 x 1242 (@3x)_landscape.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STMicroelectronics/STNFCSensor_iOS/9d87da75e6b944bfbf44ca8bbd83c582c042cdcf/SmarTAG/st_images_LanchScreen.xcassets/LaunchImage.launchimage/Launch_images_iPH6Plus_2208 x 1242 (@3x)_landscape.png -------------------------------------------------------------------------------- /SmarTAG/st_images_LanchScreen.xcassets/LaunchImage.launchimage/Launch_images_iPH6_750x1334_portrait.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STMicroelectronics/STNFCSensor_iOS/9d87da75e6b944bfbf44ca8bbd83c582c042cdcf/SmarTAG/st_images_LanchScreen.xcassets/LaunchImage.launchimage/Launch_images_iPH6_750x1334_portrait.png -------------------------------------------------------------------------------- /SmarTAG/st_images_LanchScreen.xcassets/LaunchImage.launchimage/Launch_images_iPH_640 x 1136 (@2x)_portrait.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STMicroelectronics/STNFCSensor_iOS/9d87da75e6b944bfbf44ca8bbd83c582c042cdcf/SmarTAG/st_images_LanchScreen.xcassets/LaunchImage.launchimage/Launch_images_iPH_640 x 1136 (@2x)_portrait.png -------------------------------------------------------------------------------- /SmarTAG/st_images_LanchScreen.xcassets/LaunchImage.launchimage/Launch_images_iPH_640x960-(@2x)_portrait.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STMicroelectronics/STNFCSensor_iOS/9d87da75e6b944bfbf44ca8bbd83c582c042cdcf/SmarTAG/st_images_LanchScreen.xcassets/LaunchImage.launchimage/Launch_images_iPH_640x960-(@2x)_portrait.png -------------------------------------------------------------------------------- /SmarTAG/st_images_LanchScreen.xcassets/LaunchImage.launchimage/STLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STMicroelectronics/STNFCSensor_iOS/9d87da75e6b944bfbf44ca8bbd83c582c042cdcf/SmarTAG/st_images_LanchScreen.xcassets/LaunchImage.launchimage/STLogo.png -------------------------------------------------------------------------------- /SmarTAG/st_images_svg/AboutButton.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | image/svg+xml -------------------------------------------------------------------------------- /SmarTAG/st_images_svg/acc_event_orientation_bottom_left.svg: -------------------------------------------------------------------------------- 1 | 2 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /SmarTAG/st_images_svg/acc_event_orientation_bottom_right.svg: -------------------------------------------------------------------------------- 1 | 2 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /SmarTAG/st_images_svg/acc_event_orientation_down.svg: -------------------------------------------------------------------------------- 1 | 2 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /SmarTAG/st_images_svg/acc_event_orientation_top_left.svg: -------------------------------------------------------------------------------- 1 | 2 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /SmarTAG/st_images_svg/acc_event_orientation_top_right.svg: -------------------------------------------------------------------------------- 1 | 2 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /SmarTAG/st_images_svg/acc_event_orientation_up.svg: -------------------------------------------------------------------------------- 1 | 2 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /SmarTAG/st_images_svg/event_orientation.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /SmarTAG/st_images_svg/humidity_icon.svg: -------------------------------------------------------------------------------- 1 | 2 | 38 | 39 | 42 | 44 | 47 | 50 | 51 | 52 | 54 | 55 | 57 | image/svg+xml 58 | 60 | 61 | 62 | 63 | 64 | 67 | 71 | 74 | 78 | 82 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /SmarTAGTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /SmarTAGTests/SmarTagNDefParserV1Tests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SmarTagNDefParserV1Tests.swift 3 | // SmarTAGTests 4 | // 5 | // Created by Giovanni Visentini on 26/01/2018. 6 | // 7 | 8 | import XCTest 9 | @testable import SmarTAG 10 | 11 | class SmarTagNDefParserV1Tests: XCTestCase { 12 | 13 | override func setUp() { 14 | super.setUp() 15 | // Put setup code here. This method is called before the invocation of each test method in the class. 16 | } 17 | 18 | override func tearDown() { 19 | // Put teardown code here. This method is called after the invocation of each test method in the class. 20 | super.tearDown() 21 | } 22 | 23 | func testExceptionThrowIfVersionIsDifferentFrom1(){ 24 | let version0 = Data(bytes: [0]) 25 | XCTAssertThrowsError(try SmarTagNDefParserV1(rawData:version0) ) { (error) -> Void in 26 | XCTAssertEqual(error as? SmarTagError, SmarTagError.InvalidVersion) 27 | } 28 | } 29 | 30 | func testPerformanceExample() { 31 | // This is an example of a performance test case. 32 | self.measure { 33 | // Put the code you want to measure the time of here. 34 | } 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /SmarTAGUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /SmarTAGUITests/SmarTAGUITests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SmarTAGUITests.swift 3 | // SmarTAGUITests 4 | // 5 | // Created by Giovanni Visentini on 26/01/2018. 6 | // 7 | 8 | import XCTest 9 | 10 | class SmarTAGUITests: XCTestCase { 11 | 12 | override func setUp() { 13 | super.setUp() 14 | 15 | // Put setup code here. This method is called before the invocation of each test method in the class. 16 | 17 | // In UI tests it is usually best to stop immediately when a failure occurs. 18 | continueAfterFailure = false 19 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 20 | XCUIApplication().launch() 21 | 22 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 23 | } 24 | 25 | override func tearDown() { 26 | // Put teardown code here. This method is called after the invocation of each test method in the class. 27 | super.tearDown() 28 | } 29 | 30 | func testExample() { 31 | // Use recording to get started writing UI tests. 32 | // Use XCTAssert and related functions to verify your tests produce the correct results. 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /SmarTagCloudLib/SmarTagCloudLib.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SmarTagCloudLib/SmarTagCloudLib.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /SmarTagCloudLib/SmarTagCloudLib/Config/storage/CloudConfigStorageUserSettings.swift: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 STMicroelectronics – All rights reserved 3 | * The STMicroelectronics corporate logo is a trademark of STMicroelectronics 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, this list of conditions 9 | * and the following disclaimer. 10 | * 11 | * - Redistributions in binary form must reproduce the above copyright notice, this list of 12 | * conditions and the following disclaimer in the documentation and/or other materials provided 13 | * with the distribution. 14 | * 15 | * - Neither the name nor trademarks of STMicroelectronics International N.V. nor any other 16 | * STMicroelectronics company nor the names of its contributors may be used to endorse or 17 | * promote products derived from this software without specific prior written permission. 18 | * 19 | * - All of the icons, pictures, logos and other images that are provided with the source code 20 | * in a directory whose title begins with st_images may only be used for internal purposes and 21 | * shall not be redistributed to any third party or modified in any way. 22 | * 23 | * - Any redistributions in binary form shall not include the capability to display any of the 24 | * icons, pictures, logos and other images that are provided with the source code in a directory 25 | * whose title begins with st_images. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 28 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 29 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 30 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 32 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 34 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 35 | * OF SUCH DAMAGE. 36 | */ 37 | 38 | import Foundation 39 | 40 | class CloudConfigStorageUserSettings: SmarTagCloudConfig { 41 | 42 | private static let IS_ENABLED_KEY = "isEnabled" 43 | private static let PROVIDER_KEY = "selectedProvider" 44 | private let userSettings = UserDefaults(suiteName: "CloudConfig")! 45 | 46 | var isEnabled: Bool { 47 | get{ 48 | return userSettings.bool(forKey: CloudConfigStorageUserSettings.IS_ENABLED_KEY) 49 | } 50 | set(newValue) { 51 | userSettings.set(newValue, forKey: CloudConfigStorageUserSettings.IS_ENABLED_KEY) 52 | } 53 | } 54 | 55 | var provider: String?{ 56 | get{ 57 | return userSettings.string(forKey: CloudConfigStorageUserSettings.PROVIDER_KEY) 58 | } 59 | set(newValue) { 60 | userSettings.set(newValue, forKey: CloudConfigStorageUserSettings.PROVIDER_KEY) 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /SmarTagCloudLib/SmarTagCloudLib/Config/storage/SmarTagCloudConfig.swift: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 STMicroelectronics – All rights reserved 3 | * The STMicroelectronics corporate logo is a trademark of STMicroelectronics 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, this list of conditions 9 | * and the following disclaimer. 10 | * 11 | * - Redistributions in binary form must reproduce the above copyright notice, this list of 12 | * conditions and the following disclaimer in the documentation and/or other materials provided 13 | * with the distribution. 14 | * 15 | * - Neither the name nor trademarks of STMicroelectronics International N.V. nor any other 16 | * STMicroelectronics company nor the names of its contributors may be used to endorse or 17 | * promote products derived from this software without specific prior written permission. 18 | * 19 | * - All of the icons, pictures, logos and other images that are provided with the source code 20 | * in a directory whose title begins with st_images may only be used for internal purposes and 21 | * shall not be redistributed to any third party or modified in any way. 22 | * 23 | * - Any redistributions in binary form shall not include the capability to display any of the 24 | * icons, pictures, logos and other images that are provided with the source code in a directory 25 | * whose title begins with st_images. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 28 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 29 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 30 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 32 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 34 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 35 | * OF SUCH DAMAGE. 36 | */ 37 | 38 | import Foundation 39 | 40 | public protocol SmarTagCloudConfig { 41 | var isEnabled:Bool {get set} 42 | var provider:String? {get set} 43 | } 44 | 45 | public struct SmarTagCloudConfigUtil{ 46 | public static var defaultInstance:SmarTagCloudConfig { return CloudConfigStorageUserSettings()} 47 | } 48 | -------------------------------------------------------------------------------- /SmarTagCloudLib/SmarTagCloudLib/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | NSLocationWhenInUseUsageDescription 20 | Required to send the current tag position 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | 24 | 25 | -------------------------------------------------------------------------------- /SmarTagCloudLib/SmarTagCloudLib/SmarTagCloudExported.swift: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 STMicroelectronics – All rights reserved 3 | * The STMicroelectronics corporate logo is a trademark of STMicroelectronics 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, this list of conditions 9 | * and the following disclaimer. 10 | * 11 | * - Redistributions in binary form must reproduce the above copyright notice, this list of 12 | * conditions and the following disclaimer in the documentation and/or other materials provided 13 | * with the distribution. 14 | * 15 | * - Neither the name nor trademarks of STMicroelectronics International N.V. nor any other 16 | * STMicroelectronics company nor the names of its contributors may be used to endorse or 17 | * promote products derived from this software without specific prior written permission. 18 | * 19 | * - All of the icons, pictures, logos and other images that are provided with the source code 20 | * in a directory whose title begins with st_images may only be used for internal purposes and 21 | * shall not be redistributed to any third party or modified in any way. 22 | * 23 | * - Any redistributions in binary form shall not include the capability to display any of the 24 | * icons, pictures, logos and other images that are provided with the source code in a directory 25 | * whose title begins with st_images. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 28 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 29 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 30 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 32 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 34 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 35 | * OF SUCH DAMAGE. 36 | */ 37 | 38 | import Foundation 39 | import SmarTagLib 40 | import SmarTagCloudLibCommon 41 | 42 | public class SmarTagCloudExported { 43 | 44 | private let mProvider:CloudSyncProvider? 45 | private let mLocationService = SmarTagLocationService() 46 | 47 | public init(id:String){ 48 | let config = SmarTagCloudConfigUtil.defaultInstance 49 | mProvider = CloudProviderBuilder.build(id: id, param: config) 50 | } 51 | 52 | public func sync(data:SmarTagData, onComplete:@escaping (SmarTagCloudSyncError?)->()){ 53 | let propagateError = { (error:SmarTagCloudSyncError) in 54 | onComplete(error) 55 | } 56 | mLocationService.readCurrentLocation{ [weak self] location in 57 | NSLog("Connecting...") 58 | self?.mProvider?.connect(onSuccess: { conn in 59 | NSLog("Connected") 60 | self?.mProvider?.uploadSamples(conn: conn, samples: data.samples, currentLocation: location, 61 | onSuccess: { conn in 62 | NSLog("Data Sample Uploaded") 63 | self?.mProvider?.uploadSamples(conn: conn, extremeData: data.dataExtreme, currentLocation: location, 64 | onSuccess: { conn in 65 | NSLog("Data Extreme Uploaded, Disconnecting") 66 | self?.mProvider?.disconnect(conn: conn) 67 | onComplete(nil) 68 | }, onError: propagateError) 69 | }, onError: propagateError 70 | )//uploadSample 71 | }, onError: propagateError 72 | )//connect 73 | } 74 | } 75 | 76 | } 77 | 78 | 79 | import SmarTagCloudLibMqtt 80 | 81 | public struct CloudProviderBuilder{ 82 | 83 | public static func build(id:String,param:SmarTagCloudConfig)->CloudSyncProvider?{ 84 | switch param.provider { 85 | case MqttProvider.NAME: 86 | return MqttProvider(tagId: id, config: MqttConfigStorageUtil.defaultInstance) 87 | default: 88 | return nil 89 | } 90 | } 91 | 92 | } 93 | -------------------------------------------------------------------------------- /SmarTagCloudLib/SmarTagCloudLib/SmarTagCloudLib.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 STMicroelectronics – All rights reserved 3 | * The STMicroelectronics corporate logo is a trademark of STMicroelectronics 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, this list of conditions 9 | * and the following disclaimer. 10 | * 11 | * - Redistributions in binary form must reproduce the above copyright notice, this list of 12 | * conditions and the following disclaimer in the documentation and/or other materials provided 13 | * with the distribution. 14 | * 15 | * - Neither the name nor trademarks of STMicroelectronics International N.V. nor any other 16 | * STMicroelectronics company nor the names of its contributors may be used to endorse or 17 | * promote products derived from this software without specific prior written permission. 18 | * 19 | * - All of the icons, pictures, logos and other images that are provided with the source code 20 | * in a directory whose title begins with st_images may only be used for internal purposes and 21 | * shall not be redistributed to any third party or modified in any way. 22 | * 23 | * - Any redistributions in binary form shall not include the capability to display any of the 24 | * icons, pictures, logos and other images that are provided with the source code in a directory 25 | * whose title begins with st_images. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 28 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 29 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 30 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 32 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 34 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 35 | * OF SUCH DAMAGE. 36 | */ 37 | #import 38 | 39 | //! Project version number for SmarTagCloudLib. 40 | FOUNDATION_EXPORT double SmarTagCloudLibVersionNumber; 41 | 42 | //! Project version string for SmarTagCloudLib. 43 | FOUNDATION_EXPORT const unsigned char SmarTagCloudLibVersionString[]; 44 | 45 | // In this header, you should import all the public headers of your framework using statements like #import 46 | 47 | 48 | -------------------------------------------------------------------------------- /SmarTagCloudLib/SmarTagCloudLib/SmarTagLocationService.swift: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 STMicroelectronics – All rights reserved 3 | * The STMicroelectronics corporate logo is a trademark of STMicroelectronics 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, this list of conditions 9 | * and the following disclaimer. 10 | * 11 | * - Redistributions in binary form must reproduce the above copyright notice, this list of 12 | * conditions and the following disclaimer in the documentation and/or other materials provided 13 | * with the distribution. 14 | * 15 | * - Neither the name nor trademarks of STMicroelectronics International N.V. nor any other 16 | * STMicroelectronics company nor the names of its contributors may be used to endorse or 17 | * promote products derived from this software without specific prior written permission. 18 | * 19 | * - All of the icons, pictures, logos and other images that are provided with the source code 20 | * in a directory whose title begins with st_images may only be used for internal purposes and 21 | * shall not be redistributed to any third party or modified in any way. 22 | * 23 | * - Any redistributions in binary form shall not include the capability to display any of the 24 | * icons, pictures, logos and other images that are provided with the source code in a directory 25 | * whose title begins with st_images. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 28 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 29 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 30 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 32 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 34 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 35 | * OF SUCH DAMAGE. 36 | */ 37 | 38 | import Foundation 39 | import SmarTagCloudLibCommon 40 | import CoreLocation 41 | 42 | class SmarTagLocationService : NSObject, CLLocationManagerDelegate{ 43 | 44 | private let locationManager = CLLocationManager() 45 | private var onComplete:((Location?)->())? 46 | 47 | override init(){ 48 | super.init() 49 | locationManager.delegate = self 50 | locationManager.desiredAccuracy = kCLLocationAccuracyBest 51 | } 52 | 53 | func readCurrentLocation(onComplete:@escaping (Location?)->()){ 54 | self.onComplete = onComplete 55 | manageLocationStatus(CLLocationManager.authorizationStatus()) 56 | } 57 | 58 | public func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]){ 59 | guard let location = locations.first else{ 60 | onComplete?(nil) 61 | return 62 | } 63 | 64 | manager.stopUpdatingLocation() 65 | let loc = Location(latitude: location.coordinate.latitude, 66 | longitude: location.coordinate.longitude, 67 | timestamp: location.timestamp) 68 | onComplete?(loc) 69 | } 70 | 71 | 72 | 73 | public func locationManager(_ manager: CLLocationManager, didFailWithError error: Error){ 74 | print(error) 75 | onComplete?(nil) 76 | } 77 | 78 | public func locationManager(_ manager: CLLocationManager, didChangeAuthorization status: CLAuthorizationStatus){ 79 | manageLocationStatus(status) 80 | } 81 | 82 | private func manageLocationStatus( _ status:CLAuthorizationStatus){ 83 | switch status { 84 | 85 | case .restricted, .denied: 86 | onComplete?(nil) 87 | break 88 | 89 | case .authorizedWhenInUse, .authorizedAlways: 90 | locationManager.requestLocation() 91 | break 92 | 93 | case .notDetermined: 94 | locationManager.requestWhenInUseAuthorization() 95 | break 96 | @unknown default: 97 | onComplete?(nil) 98 | } 99 | } 100 | 101 | } 102 | -------------------------------------------------------------------------------- /SmarTagCloudLibCommon/SmarTagCloudLibCommon.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SmarTagCloudLibCommon/SmarTagCloudLibCommon.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /SmarTagCloudLibCommon/SmarTagCloudLibCommon/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | 22 | 23 | -------------------------------------------------------------------------------- /SmarTagCloudLibCommon/SmarTagCloudLibCommon/Model/DataExtreme+json.swift: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 STMicroelectronics – All rights reserved 3 | * The STMicroelectronics corporate logo is a trademark of STMicroelectronics 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, this list of conditions 9 | * and the following disclaimer. 10 | * 11 | * - Redistributions in binary form must reproduce the above copyright notice, this list of 12 | * conditions and the following disclaimer in the documentation and/or other materials provided 13 | * with the distribution. 14 | * 15 | * - Neither the name nor trademarks of STMicroelectronics International N.V. nor any other 16 | * STMicroelectronics company nor the names of its contributors may be used to endorse or 17 | * promote products derived from this software without specific prior written permission. 18 | * 19 | * - All of the icons, pictures, logos and other images that are provided with the source code 20 | * in a directory whose title begins with st_images may only be used for internal purposes and 21 | * shall not be redistributed to any third party or modified in any way. 22 | * 23 | * - Any redistributions in binary form shall not include the capability to display any of the 24 | * icons, pictures, logos and other images that are provided with the source code in a directory 25 | * whose title begins with st_images. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 28 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 29 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 30 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 32 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 34 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 35 | * OF SUCH DAMAGE. 36 | */ 37 | 38 | import Foundation 39 | import SmarTagLib 40 | import SwiftyJSON 41 | 42 | extension DataExtreme { 43 | private static let MINDATE = "minDate" 44 | private static let MIN = "min" 45 | private static let MAXDATE = "maxDate" 46 | private static let MAX = "max" 47 | 48 | public var toJson:JSON{ 49 | var obj = JSON() 50 | 51 | if let min = self.minValue{ 52 | obj[DataExtreme.MIN].floatValue = min 53 | obj[DataExtreme.MINDATE].intValue = Int(self.minDate?.timeIntervalSince1970 ?? 0) 54 | } 55 | 56 | if let max = self.maxValue{ 57 | obj[DataExtreme.MAX].floatValue = max 58 | obj[DataExtreme.MAXDATE].intValue = Int(self.maxDate?.timeIntervalSince1970 ?? 0) 59 | } 60 | 61 | return obj 62 | } 63 | } 64 | 65 | extension TagExtreme { 66 | private static let START_ACQUISITION = "started" 67 | private static let ACCELERATION = "acc" 68 | private static let PRESSURE = "pres" 69 | private static let TEMPERATURE = "temp" 70 | private static let HUMIDITY = "hum" 71 | 72 | public var toJson:JSON{ 73 | var obj = JSON() 74 | obj[TagExtreme.START_ACQUISITION].intValue = Int(self.acquisitionStart.timeIntervalSince1970) 75 | 76 | if let humidity = self.humidity{ 77 | obj[TagExtreme.HUMIDITY] = humidity.toJson 78 | } 79 | 80 | if let temperature = self.temperature{ 81 | obj[TagExtreme.TEMPERATURE] = temperature.toJson 82 | } 83 | 84 | if let pressure = self.pressure{ 85 | obj[TagExtreme.PRESSURE] = pressure.toJson 86 | } 87 | 88 | if let acc = self.acceleration{ 89 | obj[TagExtreme.ACCELERATION] = acc.toJson 90 | } 91 | 92 | return obj 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /SmarTagCloudLibCommon/SmarTagCloudLibCommon/Model/Date+json.swift: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 STMicroelectronics – All rights reserved 3 | * The STMicroelectronics corporate logo is a trademark of STMicroelectronics 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, this list of conditions 9 | * and the following disclaimer. 10 | * 11 | * - Redistributions in binary form must reproduce the above copyright notice, this list of 12 | * conditions and the following disclaimer in the documentation and/or other materials provided 13 | * with the distribution. 14 | * 15 | * - Neither the name nor trademarks of STMicroelectronics International N.V. nor any other 16 | * STMicroelectronics company nor the names of its contributors may be used to endorse or 17 | * promote products derived from this software without specific prior written permission. 18 | * 19 | * - All of the icons, pictures, logos and other images that are provided with the source code 20 | * in a directory whose title begins with st_images may only be used for internal purposes and 21 | * shall not be redistributed to any third party or modified in any way. 22 | * 23 | * - Any redistributions in binary form shall not include the capability to display any of the 24 | * icons, pictures, logos and other images that are provided with the source code in a directory 25 | * whose title begins with st_images. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 28 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 29 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 30 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 32 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 34 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 35 | * OF SUCH DAMAGE. 36 | */ 37 | 38 | import Foundation 39 | import SwiftyJSON 40 | 41 | extension Date { 42 | private static let DATE = "date" 43 | public var toJson:JSON{ 44 | //milliseconds from 1970 45 | let timestamp = Int(self.timeIntervalSince1970*1000) 46 | return [Date.DATE: timestamp] 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /SmarTagCloudLibCommon/SmarTagCloudLibCommon/Model/Location+json.swift: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 STMicroelectronics – All rights reserved 3 | * The STMicroelectronics corporate logo is a trademark of STMicroelectronics 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, this list of conditions 9 | * and the following disclaimer. 10 | * 11 | * - Redistributions in binary form must reproduce the above copyright notice, this list of 12 | * conditions and the following disclaimer in the documentation and/or other materials provided 13 | * with the distribution. 14 | * 15 | * - Neither the name nor trademarks of STMicroelectronics International N.V. nor any other 16 | * STMicroelectronics company nor the names of its contributors may be used to endorse or 17 | * promote products derived from this software without specific prior written permission. 18 | * 19 | * - All of the icons, pictures, logos and other images that are provided with the source code 20 | * in a directory whose title begins with st_images may only be used for internal purposes and 21 | * shall not be redistributed to any third party or modified in any way. 22 | * 23 | * - Any redistributions in binary form shall not include the capability to display any of the 24 | * icons, pictures, logos and other images that are provided with the source code in a directory 25 | * whose title begins with st_images. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 28 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 29 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 30 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 32 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 34 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 35 | * OF SUCH DAMAGE. 36 | */ 37 | 38 | import Foundation 39 | import SwiftyJSON 40 | 41 | public extension Location { 42 | var toJson:JSON{ 43 | var obj = JSON() 44 | obj["lat"].doubleValue = self.latitude 45 | obj["long"].doubleValue = self.longitude 46 | try! obj.merge(with: self.timestamp.toJson) 47 | return obj 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /SmarTagCloudLibCommon/SmarTagCloudLibCommon/Model/SensorSample+json.swift: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 STMicroelectronics – All rights reserved 3 | * The STMicroelectronics corporate logo is a trademark of STMicroelectronics 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, this list of conditions 9 | * and the following disclaimer. 10 | * 11 | * - Redistributions in binary form must reproduce the above copyright notice, this list of 12 | * conditions and the following disclaimer in the documentation and/or other materials provided 13 | * with the distribution. 14 | * 15 | * - Neither the name nor trademarks of STMicroelectronics International N.V. nor any other 16 | * STMicroelectronics company nor the names of its contributors may be used to endorse or 17 | * promote products derived from this software without specific prior written permission. 18 | * 19 | * - All of the icons, pictures, logos and other images that are provided with the source code 20 | * in a directory whose title begins with st_images may only be used for internal purposes and 21 | * shall not be redistributed to any third party or modified in any way. 22 | * 23 | * - Any redistributions in binary form shall not include the capability to display any of the 24 | * icons, pictures, logos and other images that are provided with the source code in a directory 25 | * whose title begins with st_images. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 28 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 29 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 30 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 32 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 34 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 35 | * OF SUCH DAMAGE. 36 | */ 37 | 38 | import Foundation 39 | import SmarTagLib 40 | import SwiftyJSON 41 | 42 | extension SensorDataSample{ 43 | private static let ACCELERATION = "acc" 44 | private static let PRESSURE = "pres" 45 | private static let TEMPERATURE = "temp" 46 | private static let HUMIDITY = "hum" 47 | 48 | public var toJson:JSON { 49 | var obj = JSON() 50 | try? obj.merge(with: self.date.toJson) 51 | 52 | if let acc = self.acceleration{ 53 | obj[SensorDataSample.ACCELERATION].floatValue = acc; 54 | } 55 | 56 | if let press = self.pressure{ 57 | obj[SensorDataSample.PRESSURE].floatValue = press; 58 | } 59 | 60 | if let temp = self.temperature{ 61 | obj[SensorDataSample.TEMPERATURE].floatValue = temp; 62 | } 63 | 64 | if let hum = self.humidity{ 65 | obj[SensorDataSample.HUMIDITY].floatValue = hum; 66 | } 67 | 68 | return obj 69 | } 70 | } 71 | 72 | extension EventDataSample{ 73 | private static let ACCELERATION = "acc" 74 | private static let EVENTS = "evn" 75 | private static let ORIENTATION = "ori" 76 | 77 | public var toJson:JSON{ 78 | var obj = JSON() 79 | try? obj.merge(with: self.date.toJson) 80 | 81 | obj[EventDataSample.EVENTS].arrayObject = self.accelerationEvents.map{$0.description} 82 | 83 | if let acc = self.acceleration{ 84 | obj[EventDataSample.ACCELERATION].floatValue = acc; 85 | } 86 | 87 | if(self.currentOrientation != .unknown){ 88 | obj[EventDataSample.ORIENTATION].stringValue = self.currentOrientation.description 89 | } 90 | 91 | return obj 92 | } 93 | } 94 | 95 | extension DataSample{ 96 | public var toJson: JSON { 97 | switch self { 98 | case .sensor(let data): 99 | return data.toJson 100 | case .event(let data): 101 | return data.toJson 102 | } 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /SmarTagCloudLibCommon/SmarTagCloudLibCommon/SmarTagCloudLibCommon.h: -------------------------------------------------------------------------------- 1 | // 2 | // SmarTagCloudLibCommon.h 3 | // SmarTagCloudLibCommon 4 | // 5 | // Created by Giovanni Visentini on 20/08/2019. 6 | // Copyright © 2019 Giovanni Visentini. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for SmarTagCloudLibCommon. 12 | FOUNDATION_EXPORT double SmarTagCloudLibCommonVersionNumber; 13 | 14 | //! Project version string for SmarTagCloudLibCommon. 15 | FOUNDATION_EXPORT const unsigned char SmarTagCloudLibCommonVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | 20 | -------------------------------------------------------------------------------- /SmarTagCloudLibMqtt/SmarTagCloudLibMqtt.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SmarTagCloudLibMqtt/SmarTagCloudLibMqtt.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /SmarTagCloudLibMqtt/SmarTagCloudLibMqtt/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | 22 | 23 | -------------------------------------------------------------------------------- /SmarTagCloudLibMqtt/SmarTagCloudLibMqtt/SmarTagCloudLibMqtt.h: -------------------------------------------------------------------------------- 1 | // 2 | // SmarTagCloudLibMqtt.h 3 | // SmarTagCloudLibMqtt 4 | // 5 | // Created by Giovanni Visentini on 20/08/2019. 6 | // Copyright © 2019 Giovanni Visentini. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for SmarTagCloudLibMqtt. 12 | FOUNDATION_EXPORT double SmarTagCloudLibMqttVersionNumber; 13 | 14 | //! Project version string for SmarTagCloudLibMqtt. 15 | FOUNDATION_EXPORT const unsigned char SmarTagCloudLibMqttVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | 20 | -------------------------------------------------------------------------------- /SmarTagCloudLibMqtt/SmarTagCloudLibMqtt/configViewController/MQTTParametersViewController.swift: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 STMicroelectronics – All rights reserved 3 | * The STMicroelectronics corporate logo is a trademark of STMicroelectronics 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, this list of conditions 9 | * and the following disclaimer. 10 | * 11 | * - Redistributions in binary form must reproduce the above copyright notice, this list of 12 | * conditions and the following disclaimer in the documentation and/or other materials provided 13 | * with the distribution. 14 | * 15 | * - Neither the name nor trademarks of STMicroelectronics International N.V. nor any other 16 | * STMicroelectronics company nor the names of its contributors may be used to endorse or 17 | * promote products derived from this software without specific prior written permission. 18 | * 19 | * - All of the icons, pictures, logos and other images that are provided with the source code 20 | * in a directory whose title begins with st_images may only be used for internal purposes and 21 | * shall not be redistributed to any third party or modified in any way. 22 | * 23 | * - Any redistributions in binary form shall not include the capability to display any of the 24 | * icons, pictures, logos and other images that are provided with the source code in a directory 25 | * whose title begins with st_images. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 28 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 29 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 30 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 32 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 34 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 35 | * OF SUCH DAMAGE. 36 | */ 37 | 38 | import Foundation 39 | import UIKit 40 | 41 | class MQTTParametersViewController : UIViewController{ 42 | 43 | @IBOutlet weak var userNameText: UITextField! 44 | @IBOutlet weak var passwordText: UITextField! 45 | @IBOutlet weak var addressText: UITextField! 46 | @IBOutlet weak var portText: UITextField! 47 | @IBOutlet weak var enableTls: UISwitch! 48 | 49 | private var config = MqttConfigStorageUtil.defaultInstance; 50 | 51 | override func viewDidLoad() { 52 | userNameText.delegate = self 53 | passwordText.delegate = self 54 | addressText.delegate = self 55 | portText.delegate = self 56 | } 57 | 58 | private func loadFromSettings(){ 59 | if let user = config.userName{ 60 | userNameText.text = user 61 | } 62 | 63 | if let password = config.password{ 64 | passwordText.text = password 65 | } 66 | 67 | if let address = config.address { 68 | addressText.text = address 69 | } 70 | 71 | portText.text = String(config.port) 72 | enableTls.isOn = config.useTls 73 | } 74 | 75 | override func viewWillAppear(_ animated: Bool) { 76 | super.viewWillAppear(animated) 77 | loadFromSettings() 78 | } 79 | 80 | override func viewWillDisappear(_ animated: Bool) { 81 | super.viewWillDisappear(animated) 82 | storeSettings() 83 | } 84 | 85 | private func storeSettings(){ 86 | config.password = passwordText.text 87 | config.userName = userNameText.text 88 | config.address = addressText.text 89 | config.useTls = enableTls.isOn 90 | if let port = UInt16(portText.text ?? ""){ 91 | config.port = port 92 | } 93 | } 94 | 95 | } 96 | 97 | extension MQTTParametersViewController : UITextFieldDelegate{ 98 | public func textFieldShouldReturn(_ textField: UITextField) -> Bool{ 99 | textField.endEditing(true) 100 | return false 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /SmarTagCloudLibMqtt/SmarTagCloudLibMqtt/configViewController/MqttConfigStorage.swift: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 STMicroelectronics – All rights reserved 3 | * The STMicroelectronics corporate logo is a trademark of STMicroelectronics 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, this list of conditions 9 | * and the following disclaimer. 10 | * 11 | * - Redistributions in binary form must reproduce the above copyright notice, this list of 12 | * conditions and the following disclaimer in the documentation and/or other materials provided 13 | * with the distribution. 14 | * 15 | * - Neither the name nor trademarks of STMicroelectronics International N.V. nor any other 16 | * STMicroelectronics company nor the names of its contributors may be used to endorse or 17 | * promote products derived from this software without specific prior written permission. 18 | * 19 | * - All of the icons, pictures, logos and other images that are provided with the source code 20 | * in a directory whose title begins with st_images may only be used for internal purposes and 21 | * shall not be redistributed to any third party or modified in any way. 22 | * 23 | * - Any redistributions in binary form shall not include the capability to display any of the 24 | * icons, pictures, logos and other images that are provided with the source code in a directory 25 | * whose title begins with st_images. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 28 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 29 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 30 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 32 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 34 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 35 | * OF SUCH DAMAGE. 36 | */ 37 | 38 | import Foundation 39 | 40 | public protocol MqttConfigStorage { 41 | 42 | var userName:String?{ get set } 43 | var password:String?{ get set } 44 | var address:String?{ get set } 45 | var port:UInt16{get set} 46 | var useTls:Bool {get set} 47 | } 48 | 49 | public struct MqttConfigStorageUtil{ 50 | public static var defaultInstance:MqttConfigStorage { return MqttConfigStorageKeychain()} 51 | } 52 | -------------------------------------------------------------------------------- /SmarTagCloudLibMqtt/SmarTagCloudLibMqtt/configViewController/MqttConfigStorageKeychain.swift: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 STMicroelectronics – All rights reserved 3 | * The STMicroelectronics corporate logo is a trademark of STMicroelectronics 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, this list of conditions 9 | * and the following disclaimer. 10 | * 11 | * - Redistributions in binary form must reproduce the above copyright notice, this list of 12 | * conditions and the following disclaimer in the documentation and/or other materials provided 13 | * with the distribution. 14 | * 15 | * - Neither the name nor trademarks of STMicroelectronics International N.V. nor any other 16 | * STMicroelectronics company nor the names of its contributors may be used to endorse or 17 | * promote products derived from this software without specific prior written permission. 18 | * 19 | * - All of the icons, pictures, logos and other images that are provided with the source code 20 | * in a directory whose title begins with st_images may only be used for internal purposes and 21 | * shall not be redistributed to any third party or modified in any way. 22 | * 23 | * - Any redistributions in binary form shall not include the capability to display any of the 24 | * icons, pictures, logos and other images that are provided with the source code in a directory 25 | * whose title begins with st_images. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 28 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 29 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 30 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 32 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 34 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 35 | * OF SUCH DAMAGE. 36 | */ 37 | import Foundation 38 | import KeychainAccess 39 | 40 | class MqttConfigStorageKeychain : MqttConfigStorageUserSettings{ 41 | 42 | private static let USERNAME_KEY = "username" 43 | private static let PASSWORD_KEY = "password" 44 | 45 | private let safeUserSettings = Keychain(service: "CloudMQTTConfig") 46 | 47 | override var userName: String? { 48 | get{ 49 | return safeUserSettings[MqttConfigStorageKeychain.USERNAME_KEY] 50 | } 51 | set(newValue){ 52 | safeUserSettings[MqttConfigStorageKeychain.USERNAME_KEY] = newValue 53 | } 54 | } 55 | 56 | override var password: String?{ 57 | get{ 58 | return safeUserSettings[MqttConfigStorageKeychain.PASSWORD_KEY] 59 | } 60 | set(newValue){ 61 | safeUserSettings[MqttConfigStorageKeychain.PASSWORD_KEY] = newValue 62 | } 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /SmarTagLib/SmarTagLib.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SmarTagLib/SmarTagLib.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /SmarTagLib/SmarTagLib/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | 22 | 23 | -------------------------------------------------------------------------------- /SmarTagLib/SmarTagLib/Model/DateExtreme.swift: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 STMicroelectronics – All rights reserved 3 | * The STMicroelectronics corporate logo is a trademark of STMicroelectronics 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, this list of conditions 9 | * and the following disclaimer. 10 | * 11 | * - Redistributions in binary form must reproduce the above copyright notice, this list of 12 | * conditions and the following disclaimer in the documentation and/or other materials provided 13 | * with the distribution. 14 | * 15 | * - Neither the name nor trademarks of STMicroelectronics International N.V. nor any other 16 | * STMicroelectronics company nor the names of its contributors may be used to endorse or 17 | * promote products derived from this software without specific prior written permission. 18 | * 19 | * - All of the icons, pictures, logos and other images that are provided with the source code 20 | * in a directory whose title begins with st_images may only be used for internal purposes and 21 | * shall not be redistributed to any third party or modified in any way. 22 | * 23 | * - Any redistributions in binary form shall not include the capability to display any of the 24 | * icons, pictures, logos and other images that are provided with the source code in a directory 25 | * whose title begins with st_images. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 28 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 29 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 30 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 32 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 34 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 35 | * OF SUCH DAMAGE. 36 | */ 37 | 38 | import Foundation 39 | 40 | public struct DataExtreme{ 41 | public let minDate:Date? 42 | public let minValue:Float? 43 | public let maxDate:Date? 44 | public let maxValue:Float? 45 | 46 | init(maxDate:Date?,maxValue:Float?,minDate:Date?,minValue:Float?) { 47 | self.maxDate = maxDate 48 | self.maxValue = maxValue 49 | self.minDate = minDate 50 | self.minValue = minValue 51 | } 52 | 53 | } 54 | 55 | public struct TagExtreme{ 56 | public let acquisitionStart:Date 57 | public let temperature:DataExtreme? 58 | public let pressure:DataExtreme? 59 | public let humidity:DataExtreme? 60 | public let acceleration:DataExtreme? 61 | 62 | init(acquisitionStart:Date, temperature:DataExtreme?, 63 | pressure:DataExtreme?, humidity:DataExtreme?, acceleration:DataExtreme?) { 64 | self.acquisitionStart = acquisitionStart 65 | self.temperature = temperature 66 | self.pressure = pressure 67 | self.humidity = humidity 68 | self.acceleration = acceleration 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /SmarTagLib/SmarTagLib/Model/SmarTagStatus.swift: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 STMicroelectronics – All rights reserved 3 | * The STMicroelectronics corporate logo is a trademark of STMicroelectronics 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, this list of conditions 9 | * and the following disclaimer. 10 | * 11 | * - Redistributions in binary form must reproduce the above copyright notice, this list of 12 | * conditions and the following disclaimer in the documentation and/or other materials provided 13 | * with the distribution. 14 | * 15 | * - Neither the name nor trademarks of STMicroelectronics International N.V. nor any other 16 | * STMicroelectronics company nor the names of its contributors may be used to endorse or 17 | * promote products derived from this software without specific prior written permission. 18 | * 19 | * - All of the icons, pictures, logos and other images that are provided with the source code 20 | * in a directory whose title begins with st_images may only be used for internal purposes and 21 | * shall not be redistributed to any third party or modified in any way. 22 | * 23 | * - Any redistributions in binary form shall not include the capability to display any of the 24 | * icons, pictures, logos and other images that are provided with the source code in a directory 25 | * whose title begins with st_images. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 28 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 29 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 30 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 32 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 34 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 35 | * OF SUCH DAMAGE. 36 | */ 37 | 38 | import Foundation 39 | 40 | /** 41 | * struct containing the smarTag status 42 | * [newConfigurationAvailable] to be setted to true when a new configuration is written in the tag 43 | * [singleShotResponseReady] to read when the tag is in single shot mode, if true new data are available 44 | */ 45 | struct SmarTagStatus{ 46 | let newConfigurationAvailable:Bool 47 | let singleShotResponseReady:Bool 48 | } 49 | -------------------------------------------------------------------------------- /SmarTagLib/SmarTagLib/Model/Version.swift: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 STMicroelectronics – All rights reserved 3 | * The STMicroelectronics corporate logo is a trademark of STMicroelectronics 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, this list of conditions 9 | * and the following disclaimer. 10 | * 11 | * - Redistributions in binary form must reproduce the above copyright notice, this list of 12 | * conditions and the following disclaimer in the documentation and/or other materials provided 13 | * with the distribution. 14 | * 15 | * - Neither the name nor trademarks of STMicroelectronics International N.V. nor any other 16 | * STMicroelectronics company nor the names of its contributors may be used to endorse or 17 | * promote products derived from this software without specific prior written permission. 18 | * 19 | * - All of the icons, pictures, logos and other images that are provided with the source code 20 | * in a directory whose title begins with st_images may only be used for internal purposes and 21 | * shall not be redistributed to any third party or modified in any way. 22 | * 23 | * - Any redistributions in binary form shall not include the capability to display any of the 24 | * icons, pictures, logos and other images that are provided with the source code in a directory 25 | * whose title begins with st_images. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 28 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 29 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 30 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 32 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 34 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 35 | * OF SUCH DAMAGE. 36 | */ 37 | import Foundation 38 | 39 | public struct Version{ 40 | public let majour:UInt8 41 | public let minor:UInt8 42 | public let patch:UInt8 43 | 44 | init(majour:UInt8,minor:UInt8,patch:UInt8){ 45 | self.majour = majour; 46 | self.minor = minor; 47 | self.patch = patch; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /SmarTagLib/SmarTagLib/SmarTagIOProtocol.swift: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 STMicroelectronics – All rights reserved 3 | * The STMicroelectronics corporate logo is a trademark of STMicroelectronics 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, this list of conditions 9 | * and the following disclaimer. 10 | * 11 | * - Redistributions in binary form must reproduce the above copyright notice, this list of 12 | * conditions and the following disclaimer in the documentation and/or other materials provided 13 | * with the distribution. 14 | * 15 | * - Neither the name nor trademarks of STMicroelectronics International N.V. nor any other 16 | * STMicroelectronics company nor the names of its contributors may be used to endorse or 17 | * promote products derived from this software without specific prior written permission. 18 | * 19 | * - All of the icons, pictures, logos and other images that are provided with the source code 20 | * in a directory whose title begins with st_images may only be used for internal purposes and 21 | * shall not be redistributed to any third party or modified in any way. 22 | * 23 | * - Any redistributions in binary form shall not include the capability to display any of the 24 | * icons, pictures, logos and other images that are provided with the source code in a directory 25 | * whose title begins with st_images. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 28 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 29 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 30 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 32 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 34 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 35 | * OF SUCH DAMAGE. 36 | */ 37 | 38 | import Foundation 39 | 40 | public enum SmarTagIOError : Error{ 41 | case malformedNDef 42 | case wrongProtocolVersion 43 | case lostConnection 44 | case tagResponseError 45 | case unknown 46 | } 47 | 48 | public protocol SmarTagIO{ 49 | typealias IOResult = Result 50 | 51 | var id:Data? {get} 52 | 53 | func read(address: Int, onComplete: @escaping (IOResult)->Void) 54 | func read(range: Range, onComplete: @escaping (IOResult)->Void) 55 | func write(startAddress:Int, data:Data, onComplete:@escaping (SmarTagIOError?)->Void) 56 | 57 | } 58 | 59 | internal extension SmarTagIO { 60 | func readStringFromByteOffset(byteOffset:Int, length:Int, onComplete: @escaping (Result)->()){ 61 | 62 | let (startBlock, blockOffset) = byteOffset.quotientAndRemainder(dividingBy: 4) 63 | let endBlock = startBlock + (length+blockOffset+4)/4 // +4 to have the floor 64 | read(range: startBlock.. 10 | 11 | //! Project version number for SmarTagLib. 12 | FOUNDATION_EXPORT double SmarTagLibVersionNumber; 13 | 14 | //! Project version string for SmarTagLib. 15 | FOUNDATION_EXPORT const unsigned char SmarTagLibVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | 20 | -------------------------------------------------------------------------------- /SmarTagLib/SmarTagLib/SmarTagNDefParserProtocolFake.swift: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 STMicroelectronics – All rights reserved 3 | * The STMicroelectronics corporate logo is a trademark of STMicroelectronics 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, this list of conditions 9 | * and the following disclaimer. 10 | * 11 | * - Redistributions in binary form must reproduce the above copyright notice, this list of 12 | * conditions and the following disclaimer in the documentation and/or other materials provided 13 | * with the distribution. 14 | * 15 | * - Neither the name nor trademarks of STMicroelectronics International N.V. nor any other 16 | * STMicroelectronics company nor the names of its contributors may be used to endorse or 17 | * promote products derived from this software without specific prior written permission. 18 | * 19 | * - All of the icons, pictures, logos and other images that are provided with the source code 20 | * in a directory whose title begins with st_images may only be used for internal purposes and 21 | * shall not be redistributed to any third party or modified in any way. 22 | * 23 | * - Any redistributions in binary form shall not include the capability to display any of the 24 | * icons, pictures, logos and other images that are provided with the source code in a directory 25 | * whose title begins with st_images. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 28 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 29 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 30 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 32 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 34 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 35 | * OF SUCH DAMAGE. 36 | */ 37 | 38 | import Foundation 39 | 40 | 41 | -------------------------------------------------------------------------------- /buildDep.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | carthage bootstrap --cache-builds --platform iOS 4 | 5 | #build the dependency for SmarTagCloud 6 | #cd SmarTagCloudLib 7 | #carthage build --cache-builds --platform iOS 8 | 9 | 10 | -------------------------------------------------------------------------------- /makeReleaseZip.sh: -------------------------------------------------------------------------------- 1 | #/bin/bash 2 | 3 | versionName=$1 4 | 5 | git tag $versionName 6 | git push --tags origin 7 | 8 | zip -r ../iosSrc_$versionName.zip . -x '*.git*' '*Carthage/Checkouts*' 9 | --------------------------------------------------------------------------------