lib/imperituroard.rb in imperituroard-0.1.8 vs lib/imperituroard.rb in imperituroard-0.1.9

- old
+ new

@@ -4,10 +4,11 @@ require "imperituroard/version" require "imperituroard/phpipamdb" require "imperituroard/phpipamcps" require "imperituroard/projects/iot/mongoconnector" require "imperituroard/projects/iot/hua_oceanconnect_adapter" +require 'json' module Imperituroard class Error < StandardError; end def initialize() @@ -78,19 +79,39 @@ @database = database @iotplatform_ip = iotplatform_ip @iotplatform_port = iotplatform_port end + + def test() ddd = MongoIot.new(mongoip, mongoport, iotip, database) ddd.ttt end def testhua() - ddd1 = HuaIot.new(iotplatform_ip, iotplatform_port, "", "") - ddd1.test - + cert_file = "/Users/imperituroard/Desktop/cert.crt" + key_file = "/Users/imperituroard/Desktop/key.pem" + ddd1 = HuaIot.new(iotplatform_ip, iotplatform_port, "", "", cert_file, key_file) + #p ddd1.dev_register_verif_code_mode("Cd1v0k2gTBCbpQlMVlW1FVqOSqga", "kbfo5JlBxTIhjVwtjHleWS5Iw5wa", "7521234165452") + #ddd1.querying_device_id("Cd1v0k2gTBCbpQlMVlW1FVqOSqga", "kbfo5JlBxTIhjVwtjHleWS5Iw5wa", "a8834c5e-4b4d-4f0f-ad87-14e916f3d0bb") + #ddd1.querying_device_activ_status("Cd1v0k2gTBCbpQlMVlW1FVqOSqga", "kbfo5JlBxTIhjVwtjHleWS5Iw5wa", "7521234165452") + #ddd1.querying_device_info("Cd1v0k2gTBCbpQlMVlW1FVqOSqga", "kbfo5JlBxTIhjVwtjHleWS5Iw5wa", "a8834c5e-4b4d-4f0f-ad87-14e916f3d0bb") + list = ["41c0ba82-d771-4669-b766-fcbfbedc17f4", "7521234165452", "feb9c4d1-4944-4b04-a717-df87dfde30f7", "9868e121-c309-4f4f-8ab3-0aa69072caff", "b3b82f35-0723-4a83-90af-d4ea40017194"] + #p ddd1.querying_device_direct_conn("Cd1v0k2gTBCbpQlMVlW1FVqOSqga", "kbfo5JlBxTIhjVwtjHleWS5Iw5wa", list) + #p ddd1.querying_device_type_list("Cd1v0k2gTBCbpQlMVlW1FVqOSqga", "kbfo5JlBxTIhjVwtjHleWS5Iw5wa") + p ddd1.querying_device_id("Cd1v0k2gTBCbpQlMVlW1FVqOSqga", "kbfo5JlBxTIhjVwtjHleWS5Iw5wa", "7521234165452") + #ddd1.dev_delete("Cd1v0k2gTBCbpQlMVlW1FVqOSqga", "kbfo5JlBxTIhjVwtjHleWS5Iw5wa", "484114f6-a49c-4bab-88e6-4ddaf1cc1c8f") end + def testhua2() + tt = "{\"deviceId\":\"fad0a417-b6a3-4b0b-abfc-fa2b0af9691a\",\"verifyCode\":\"6cb6dcca\",\"timeout\":180,\"psk\":\"1d16b55d577bc1f2e5e75d416ce6b8a2\"}" + #tt = tt.gsub("\\","") + #p tt + ff = tt.to_s + p ff + gg = JSON.parse(ff) + p gg + end end