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

Commit

Permalink
working on device registration
Browse files Browse the repository at this point in the history
  • Loading branch information
fulton committed Jan 1, 2020
1 parent 0f12ceb commit d692efb
Showing 1 changed file with 8 additions and 17 deletions.
25 changes: 8 additions & 17 deletions src/main/java/com/andromeda/araserver/iot/NewDevice.kt
Original file line number Diff line number Diff line change
@@ -1,25 +1,16 @@
package com.andromeda.araserver.iot

import okhttp3.OkHttpClient
import okhttp3.Request
import java.io.IOException
import com.microsoft.azure.sdk.iot.service.Device
import com.microsoft.azure.sdk.iot.service.RegistryManager
import com.microsoft.azure.sdk.iot.service.auth.AuthenticationType

class NewDevice {
fun main(){
val url = ""
val client = OkHttpClient()
var json = ""
val request = Request.Builder()
.url(url)
.addHeader("Accept", "application/x-javascript")
.build()

client.newCall(request).execute().use { response ->
if (!response.isSuccessful) throw IOException("Unexpected code $response")
class NewDevice {
fun main(url: String){
val mainVal = url.replace("/newdevice/", "")

json = response.body!!.string()
println(json)
}
val rm = RegistryManager()
val device = Device.createDevice("", AuthenticationType.SAS)
}

}

0 comments on commit d692efb

Please sign in to comment.