Class: Iot

Inherits:
Object
  • Object
show all
Defined in:
lib/imperituroard.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(mongoip, mongoport, iotip, mongo_database, iotplatform_ip, iotplatform_port, cert_path, key_path, telegram_api_url, telegram_chat_id) ⇒ Iot

Returns a new instance of Iot.



125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# File 'lib/imperituroard.rb', line 125

def initialize(mongoip,
               mongoport,
               iotip,
               mongo_database,
               iotplatform_ip,
               iotplatform_port,
               cert_path,
               key_path,
               telegram_api_url,
               telegram_chat_id
  #real_ip,
  #remote_ip
)
  @param_all = {:mongoip => mongoip,
                :mongoport => mongoport,
                :iotip => iotip,
                :mongo_database => mongo_database,
                :iotplatform_ip => iotplatform_ip,
                :cert_path => cert_path,
                :key_path => key_path
  }
  @mongo_client = MongoIot.new(param_all[:mongoip], param_all[:mongoport], param_all[:mongo_database])
  @add_functions_connector = AdditionalFunc.new(telegram_api_url, telegram_chat_id)
  #@real_ip = real_ip
  #@remote_ip = remote_ip
  @hua_aceanconnect_connector = HuaIot.new(iotplatform_ip, iotplatform_port, cert_path, key_path, param_all[:mongoip], param_all[:mongoport], param_all[:mongo_database])
  @internal_func = InternalFunc.new
  @iot_connector = IotFunctions_2.new(param_all[:mongoip], param_all[:mongoport], iotip, param_all[:mongo_database],
                                      iotplatform_ip, iotplatform_port, cert_path, key_path, telegram_api_url, telegram_chat_id)
end

Instance Attribute Details

#add_functions_connectorObject

Returns the value of attribute add_functions_connector.



116
117
118
# File 'lib/imperituroard.rb', line 116

def add_functions_connector
  @add_functions_connector
end

#hua_aceanconnect_connectorObject

Returns the value of attribute hua_aceanconnect_connector.



116
117
118
# File 'lib/imperituroard.rb', line 116

def hua_aceanconnect_connector
  @hua_aceanconnect_connector
end

#internal_funcObject

Returns the value of attribute internal_func.



116
117
118
# File 'lib/imperituroard.rb', line 116

def internal_func
  @internal_func
end

#iot_connectorObject

Returns the value of attribute iot_connector.



116
117
118
# File 'lib/imperituroard.rb', line 116

def iot_connector
  @iot_connector
end

#mongo_clientObject

Returns the value of attribute mongo_client.



116
117
118
# File 'lib/imperituroard.rb', line 116

def mongo_client
  @mongo_client
end

#param_allObject

Returns the value of attribute param_all.



116
117
118
# File 'lib/imperituroard.rb', line 116

def param_all
  @param_all
end

Instance Method Details

#add_device_to_profile(login, imei_list, real_ip, remote_ip) ⇒ Object

!!1. Add device to profile (only for new device) login - login for client identification profile - profile for device imei_list - device identificator imei_list = [=> 131234123412341233, “description” => “dfdsf”, “note”=>“second description”, “profile”=>0, “device_type”=>“phone”, => 56213126347645784, “description” => “dfdsf”, “note”=>“second description”, “profile”=>0] massive commands +++ iot logic added



171
172
173
# File 'lib/imperituroard.rb', line 171

def add_device_to_profile(, imei_list, real_ip, remote_ip)
  iot_connector.add_device_to_prof_2(, imei_list, real_ip, remote_ip)
end

#add_device_to_profile2(request_f, real_ip, remote_ip) ⇒ Object



175
176
177
# File 'lib/imperituroard.rb', line 175

def add_device_to_profile2(request_f, real_ip, remote_ip)
  iot_connector.add_device_to_prof2_2(request_f, real_ip, remote_ip)
end

#add_service(login, device_list, real_ip, remote_ip) ⇒ Object

6 add service by SPA imei profile imsi msisdn newdevice_list=[:attributes=>{:address=>“Golubeva51”, :profile=>“wqeqcqeqwev”, :msisdn=>375298766719, :imsi=>25702858586756875}] +



233
234
235
# File 'lib/imperituroard.rb', line 233

def add_service(, device_list, real_ip, remote_ip)
  iot_connector.add_service_2(, device_list, real_ip, remote_ip)
end

#autorize_subscriber(login, password, real_ip, remote_ip) ⇒ Object

7 procedure for subscriber autorization



238
239
240
# File 'lib/imperituroard.rb', line 238

def autorize_subscriber(, password, real_ip, remote_ip)
  iot_connector.autorize_subscriber_2(, password, real_ip, remote_ip)
end

#delete_all_iot_device_in_dbObject

technological procedures



297
298
299
# File 'lib/imperituroard.rb', line 297

def delete_all_iot_device_in_db
  iot_connector.delete_all_devices_in_database
end

#device_add_address(login, newdevice_list, real_ip, remote_ip) ⇒ Object

!5 add address to device login imei = newdevice_list address = newdevice_list newdevice_list=[:address=>“Golubeva51”] +++ iot platform integration completed



222
223
224
# File 'lib/imperituroard.rb', line 222

def device_add_address(, newdevice_list, real_ip, remote_ip)
  iot_connector.device_add_address_2(, newdevice_list, real_ip, remote_ip)
end

#device_find(login, imei_list, real_ip, remote_ip) ⇒ Object

!!2 Find device (only mongo datebase. IOT platform not need) procedure for data selection from mongo database. for this function IOT platform not need login imei imei_list =[41234,23452345,132412] ++



187
188
189
# File 'lib/imperituroard.rb', line 187

def device_find(, imei_list, real_ip, remote_ip)
  iot_connector.device_find_2(, imei_list, real_ip, remote_ip)
end

#device_remove(login, imei, real_ip, remote_ip) ⇒ Object

!!4 remove device login imei not massive commands imei=11341341234 login=“test” +++ IOT logic added



210
211
212
# File 'lib/imperituroard.rb', line 210

def device_remove(, imei, real_ip, remote_ip)
  iot_connector.device_remove_2(, imei, real_ip, remote_ip)
end

#get_available_profiles(login, real_ip, remote_ip) ⇒ Object

8 get available profiles for login



243
244
245
# File 'lib/imperituroard.rb', line 243

def get_available_profiles(, real_ip, remote_ip)
  iot_connector.get_available_prof_2(, real_ip, remote_ip)
end

#get_available_types(login, real_ip, remote_ip) ⇒ Object

9 get available types for login



248
249
250
# File 'lib/imperituroard.rb', line 248

def get_available_types(, real_ip, remote_ip)
  iot_connector.get_available_types_2(, real_ip, remote_ip)
end

#get_available_types2(login, profile, real_ip, remote_ip) ⇒ Object

9-1 get available types for login and profile



253
254
255
# File 'lib/imperituroard.rb', line 253

def get_available_types2(, profile, real_ip, remote_ip)
  iot_connector.get_available_types2_2(, profile, real_ip, remote_ip)
end

#get_info_data_profile(profile, real_ip, remote_ip) ⇒ Object

11 get info for profile



263
264
265
# File 'lib/imperituroard.rb', line 263

def get_info_data_profile(profile, real_ip, remote_ip)
  iot_connector.get_info_data_profile_2(profile, real_ip, remote_ip)
end

#get_info_data_type(type, real_ip, remote_ip) ⇒ Object

10 get info for device type



258
259
260
# File 'lib/imperituroard.rb', line 258

def get_info_data_type(type, real_ip, remote_ip)
  iot_connector.get_info_data_type_2(type, real_ip, remote_ip)
end

#imei_replace(login, im_list, real_ip, remote_ip) ⇒ Object

!3 device modify, change imei login imei_old imei_new massive commands im_list = [“imei_new”=>7967843245665] ++



198
199
200
# File 'lib/imperituroard.rb', line 198

def imei_replace(, im_list, real_ip, remote_ip)
  iot_connector.imei_replace_2(, im_list, real_ip, remote_ip)
end

#logger_to_audit_database(proc_name, src_ip, input_json, output_json, real_ip) ⇒ Object



289
290
291
# File 'lib/imperituroard.rb', line 289

def logger_to_audit_database(proc_name, src_ip, input_json, output_json, real_ip)
  mongo_client.audit_logger(proc_name, src_ip, input_json, output_json, real_ip)
end

#sdk_spa_service_set(soapgw_params, real_ip, remote_ip) ⇒ Object

15 integration with SPA add imei to correct profile



278
279
280
281
282
283
284
285
286
# File 'lib/imperituroard.rb', line 278

def sdk_spa_service_set(soapgw_params, real_ip, remote_ip)
  #imei
  #imsi
  #msisdn
  #unp
  #note
  #descriptiot
  iot_connector.spa_service_set_2(soapgw_params, real_ip, remote_ip)
end

#set_data_replace(soapgw_params, real_ip, remote_ip) ⇒ Object

13 replace data for imei. Replace Type and Profile new procedure 2020-06-06 params = “token”=>“token”, “datalist”=>[“new_profile”=>“3”, “new_type”=>“1000001”, “new_profile”=>“1”, “new_type”=>“1000003”]} answer = :result=>“Success”, :body=>{:processednum=>1, :failednum=>1, :deviceserr=>}}



272
273
274
# File 'lib/imperituroard.rb', line 272

def set_data_replace(soapgw_params, real_ip, remote_ip)
  iot_connector.set_data_replace_2(soapgw_params, real_ip, remote_ip)
end

#test111Object



301
302
303
# File 'lib/imperituroard.rb', line 301

def test111
  iot_connector.test1278493
end