Skip to content
This repository has been archived by the owner on Oct 3, 2020. It is now read-only.

Commit

Permalink
working on IOT
Browse files Browse the repository at this point in the history
  • Loading branch information
fulton committed Dec 21, 2019
1 parent 7d1e61f commit f870fc6
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 0 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ dependencies {
compile 'org.nanohttpd:nanohttpd:2.3.1'
compile 'org.hibernate:hibernate-agroal:5.4.10.Final'
implementation"com.squareup.okhttp3:okhttp:4.2.0"
implementation 'com.microsoft.azure:azure-documentdb:2.4.5'
compile group: 'org.apache.opennlp', name: 'opennlp-tools', version: '1.9.1'
compile group: 'com.microsoft.sqlserver', name: 'mssql-jdbc', version: '7.4.1.jre11'

Expand Down
25 changes: 25 additions & 0 deletions src/main/java/com/andromeda/araserver/iot/Main.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,33 @@
package com.andromeda.araserver.iot

import com.microsoft.azure.documentdb.ConnectionPolicy
import com.microsoft.azure.documentdb.ConsistencyLevel
import com.microsoft.azure.documentdb.DocumentClient


class Main {
fun main(url:String){
val mainVal = url.replace("/devices/", "")
val actions = mainVal.split("&")
val dbLink = System.getenv("IOTDB")
var id:String? = null
var action:String? = null
var client = DocumentClient(
"https://ara-account-data.documents.azure.com:443/",
dbLink,
ConnectionPolicy(),
ConsistencyLevel.Session
)

for (i in actions){
when {
i.startsWith("id=") -> id = i.replace("id=", "")
i.startsWith("run=") -> action = i.replace("run=", "")
else -> throw SecurityException("not a valid set of arguments")
}
}



}
}
23 changes: 23 additions & 0 deletions src/main/java/com/andromeda/araserver/util/DeviceModel.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright (c) 2019. Fulton Browne
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package com.andromeda.araserver.util

import java.util.*

data class DeviceModel(val name: String, val type: String, var status: String, var group:String) {
val id = UUID.randomUUID().toString()
}

0 comments on commit f870fc6

Please sign in to comment.