Skip to content

Commit

Permalink
Put all the main folders in root
Browse files Browse the repository at this point in the history
Put all the main folders in root
  • Loading branch information
sw-tt-rushabhpatel committed Oct 18, 2022
1 parent 7bcbab2 commit c4406f8
Show file tree
Hide file tree
Showing 113 changed files with 62 additions and 508 deletions.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@
06AA0EF92656337100FC8F55 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1240;
LastUpgradeCheck = 1340;
TargetAttributes = {
06AA0F012656337100FC8F55 = {
CreatedOnToolsVersion = 12.4;
Expand Down Expand Up @@ -648,7 +648,7 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = IoTConnect/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -676,7 +676,7 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = IoTConnect/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
//
// Config.swift
// IoTConnect
//
// Created by PC4111 on 24/05/21.
//

import Foundation

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
//
// ErrosLog.swift
// IoTConnect
//
// Created by PC4111 on 20/08/21.
//

import Foundation

Expand All @@ -22,49 +19,25 @@ struct Log {//class
enum Errors: String {
case ERR_IN01 = "<<Exception error message>>"
case ERR_IN02 = "Discovery URL can not be blank"
// case ERR_IN03 = "Missing required parameter 'discoveryUrl' in sdkOptions"
// case ERR_IN04 = "cpId can not be blank"
// case ERR_IN05 = "uniqueId can not be blank"
case ERR_IN06 = "SDK options : set proper certificate file path and try again"
// case ERR_IN07 = "Log directory should be with proper permission to read and write"
// case ERR_IN08 = "Network connection error or invalid url"
case ERR_IN09 = "Unable to get baseUrl"
case ERR_IN10 = "Device information not found"
case ERR_IN11 = "Device broker information not found"
// case ERR_IN12 = "CPID not found"
// case ERR_IN13 = "Client connection failed."
case ERR_IN14 = "Client connection closed"
// case ERR_IN15 = "Missing required parameter 'cpId' or 'uniqueId' or 'env' to initialize the device connection"
// case ERR_SD01 = "<<Exception error message>> "
case ERR_SD02 = "It does not matched with payload's 'uniqueId'"
// case ERR_SD03 = "It does not matched with predefined standard date time format for payload's 'time'"
// case ERR_SD04 = "Device is barred SendData() method is not permitted"
// case ERR_SD05 = "Invalid data type to send the data. It should be in array of object type"
case ERR_SD06 = "Missing required parameter 'data'"
// case ERR_SD07 = "Missing required parameter 'time'"
// case ERR_SD08 = "Missing required parameter 'uniqueId'"
// case ERR_SD09 = "Device information not found in local memory."
case ERR_SD10 = "Publish data failed : MQTT connection not found"
// case ERR_SD11 = "Unknown broker protocol"
case ERR_TP01 = "<<Exception error message>> "
case ERR_TP02 = "Device is barred updateTwin() method is not permitted"
case ERR_TP03 = "Missing required parameter 'key' or 'value' to update twin property"
case ERR_TP04 = "Device is barred getAllTwins() method is not permitted"
case ERR_CM01 = "<<Exception error message>> "
case ERR_CM02 = "Missing required parameter 'data' or 'msgType' to send acknowledgement"
// case ERR_CM03 = "Invalid data type to send the acknowledgment. It should be in 'object' type"
case ERR_CM04 = "Device is barred SendAck() method is not permitted"
case ERR_OS01 = " <<Exception error message>>"
// case ERR_OS02 = "Error while creating log directory"
// case ERR_OS03 = "Unable to read or write file"
case ERR_OS04 = "Unable to scan directory"
// case ERR_DC01 = "<<Exception error message>> "
case ERR_DC02 = "Connection not available"
// case ERR_DC03 = "Device is barred Dispose() method is not permitted"//...New
// case ERR_GA01 = "<<Exception error message>> "
case ERR_GA02 = "Attributes data not found"
//case ERR_GA03 = "Device is barred getAttributes() method is not permitted"//...New
// case ERR_EE01 = "<<Exception error message>> "
case ERR_PS01 = "JSON parsing error" //...New
}
enum Info: String {
Expand All @@ -83,36 +56,24 @@ struct Log {//class
case INFO_IN13 = "Response Code : 5 'OBJECT_MOVED'"
case INFO_IN14 = "Response Code : 6 'CPID_NOT_FOUND'"
case INFO_IN15 = "Response Code : 'NO_RESPONSE_CODE_MATCHED'"

case INFO_SD01 = "Publish data"

case INFO_TP01 = "Twin property updated successfully"
case INFO_TP02 = "Request sent successfully to get the all twin properties."

case INFO_CM01 = "Command : 0x01 : STANDARD_COMMAND"
case INFO_CM02 = "Command : 0x02 : FIRMWARE_UPDATE"
case INFO_CM03 = "Command : 0x10 : ATTRIBUTE_UPDATE"
case INFO_CM04 = "Command : 0x11 : SETTING_UPDATE"
case INFO_CM05 = "Command : 0x12 : PASSWORD_UPDATE"
case INFO_CM06 = "Command : 0x13 : DEVICE_UPDATE"
// case INFO_CM07 = "Command : 0x15 : RULE_UPDATE"
case INFO_CM08 = "Command : 0x99 : STOP_SDK_CONNECTION"
// case INFO_CM09 = "Command : 0x16 : SDK_CONNECTION_STATUS"
case INFO_CM10 = "Command acknowledgement success"
case INFO_CM11 = "Command : 0x17 : DATA_FREQUENCY_UPDATE"

// case INFO_OS01 = "Publish offline data"
case INFO_OS02 = "Offline data saved"
case INFO_OS03 = "File has been created to store offline data"
case INFO_OS04 = "Offline log file deleted"
case INFO_OS05 = "No offline data found"
case INFO_OS06 = "Offline data publish :: Send/Total :: "

case INFO_DC01 = "Device already disconnected"
//
case INFO_GA01 = "Get attributes successfully"

// case INFO_EE01 = "Edge Device :: Rule 'MATCHED'"
// case INFO_EE02 = "Edge Device :: Rule 'NOT MATCHED'"
}
}
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
//
// IoTConnect.h
// IoTConnect
//
// Created by PC4111 on 20/05/21.
//

#import <Foundation/Foundation.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,14 +245,7 @@ class IoTConnectManager {
"dt": self.objCommon.dataTypeToString(value: attrib["dt"] as! Int),
"tw": attrib["tw"] ?? nil,
"d" : []
] //attrib.tw == "" ? undefined : attrib.tw
/*if(attrib["p"]as! String != "") {
attrib.removeValue(forKey: "agt")
var pcAttributes = ["ln" : attrib["p"],
"dt": dataTypeToString(attrib.dt),
"tw": attrib.tw == "" ? undefined : attrib.tw,
"d" : []]
}*/
]

(attrib["d"] as! [[String:Any]]).forEach { (attData) in
let att = attData
Expand All @@ -263,7 +256,7 @@ class IoTConnectManager {
"dv": att["dv"],
"tg": att["tg"] ?? nil,
"tw": att["tw"] ?? nil
] //att.tg == "" ? undefined : att.tg//att.tw == "" ? undefined : att.tw
]

var dA = pcAttributes["d"] as! [[String:Any]]
dA.append(cAttribute as [String : Any])
Expand All @@ -290,23 +283,12 @@ class IoTConnectManager {
if (attrib["tg"] as! String == device["tg"] as! String) {// Parent
attrib.removeValue(forKey: "agt")
var pcAttributes = [
"ln" : attrib["p"],
"ln" : attrib["p"] ?? "",
"dt": self.objCommon.dataTypeToString(value: attrib["dt"] as! Int),
"tg": attrib["tg"] ?? nil,
"tw": attrib["tw"] ?? nil,
"tg": attrib["tg"] ?? "",
"tw": attrib["tw"] ?? "",
"d" : []
]//attrib.tg == "" ? undefined : attrib.tg,//attrib.tw == "" ? undefined : attrib.tw,
/*if(attrib.p != "")
{
delete attrib.agt;
var pcAttributes = {
"ln" : attrib.p,
"dt": dataTypeToString(attrib.dt),
"tg": attrib.tg == "" ? undefined : attrib.tg,
"tw": attrib.tw == "" ? undefined : attrib.tw,
"d" : []
};
}*/
] as [String : Any]
(attrib["d"] as! [[String:Any]]).forEach { (attData) in
let att = attData
if(att["tg"] as! String == device["tg"] as! String) {// Parent
Expand All @@ -316,7 +298,7 @@ class IoTConnectManager {
"dv": att["dv"],
"tg": att["tg"] ?? nil,
"tw": att["tw"] ?? nil
] //att.tg == "" ? undefined : att.tg//att.tw == "" ? undefined : att.tw
]

var dA = pcAttributes["d"] as! [[String:Any]]
dA.append(cAttribute as [String : Any])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ extension IoTConnectManager {
objCommon.manageDebugLog(code: Log.Info.INFO_IN04, uniqueId: uniqueId, cpId: cpId, message: "", logFlag: true, isDebugEnabled: boolDebugYN)
objCommon.getBaseURL(strURL: SDKURL.discovery(strDiscoveryURL, cpId, SDKConstants.Language, SDKConstants.Version, strEnv.rawValue)) { (status, data) in
if status {
//print("Success Main: \(data)")
if let dataRef = data as? [String : Any] {
self.objCommon.manageDebugLog(code: Log.Info.INFO_IN07, uniqueId: uniqueId, cpId: cpId, message: "", logFlag: true, isDebugEnabled: self.boolDebugYN)
self.dictReference = dataRef
Expand All @@ -31,7 +30,6 @@ extension IoTConnectManager {
if let error = data as? Error {
self.objCommon.manageDebugLog(code: Log.Errors.ERR_IN01, uniqueId: uniqueId, cpId: cpId, message: error.localizedDescription, logFlag: false, isDebugEnabled: self.boolDebugYN)
}
//print("Error parsing Main: \(data)")
}
}
}
Expand All @@ -44,11 +42,7 @@ extension IoTConnectManager {

if error == nil {
let errorParse: Error? = nil

/*if let JSONString = String(data: data!, encoding: .utf8) {
print("JSONString: ", JSONString)
}*/


let dataDeviceTemp = try? JSONSerialization.jsonObject(with: data!, options: .mutableContainers)

if dataDeviceTemp == nil {
Expand All @@ -57,7 +51,6 @@ extension IoTConnectManager {
self.objCommon.manageDebugLog(code: Log.Errors.ERR_PS01, uniqueId: self.strUniqueId, cpId: self.strCPId, message: errorParse?.localizedDescription ?? "", logFlag: false, isDebugEnabled: self.boolDebugYN)

} else {
//print("Success DSC: ", dataDeviceTemp as Any)
let dataDevice = dataDeviceTemp as! [String:Any]
if dataDevice["d"] != nil {
self.objCommon.manageDebugLog(code: Log.Info.INFO_IN01, uniqueId: self.strUniqueId, cpId: self.strCPId, message: "", logFlag: true, isDebugEnabled: self.boolDebugYN)
Expand Down Expand Up @@ -370,7 +363,7 @@ extension IoTConnectManager {
var arrayFltTmp:[[String:Any]] = []
var arrayRptTmp:[[String:Any]] = []
let strkeyPathM = KeyPath("data.\(strKey)")
for strKeyChild: String in (dictSDKInput[keyPath:strkeyPathM] as! [String:Any]).keys {//for (NSString *strKeyChild in [[dictSDKInput valueForKeyPath:[@"data." stringByAppendingString:strKey]] allKeys]) {
for strKeyChild: String in (dictSDKInput[keyPath:strkeyPathM] as! [String:Any]).keys {
let strkeyPath = KeyPath("data.\(strKey).\(strKeyChild)")
let dictForm = getAttributeForm(with: dictSelectAttribute!, withForKey: strKeyChild, withValue: dictSDKInput[keyPath:strkeyPath]!, withIsParent: false, withTag: "") as [String:Any]
if dictForm.count > 0 {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
//
// MQTTClient.swift
// IoTConnect
//
// Created by PC4111 on 04/06/21.
//

import Foundation

Expand Down Expand Up @@ -134,8 +131,6 @@ class MQTTClient {
dataOffline.removeValue(forKey: "cpId")
}
print("fileSize-Bytes: ", fileSize as Any)
// fileSize = fileSize as! Int/1000
// print("fileSize-KB: ", fileSize as Any )
if offlinePerFileDataLimit > fileSize as! Int || offlinePerFileDataLimit == 0 {
//In File Size Limit or limited
do {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

import Foundation

//{"d":{"sc":{"hb":{"fq":10,"h":"","un":"","pwd":"","pub":""},"log":{"h":"","un":"","pwd":"","pub":""},"sf":0,"df":60},"p":{"n":"mqtt","h":"qa-iconnect-core-iothub-cu.azure-devices.net","p":8883,"id":"nine-ios","un":"qa-iconnect-core-iothub-cu.azure-devices.net/nine-ios/?api-version=2018-06-30","pwd":"SharedAccessSignature sr=qa-iconnect-core-iothub-cu.azure-devices.net%2Fdevices%2Fnine-ios&sig=2KGYAhE0o3gwwXz2GWtUy9JTcfvlu%2F8SRwH7WViNcbk%3D&se=1661346098","pub":"devices/nine-ios/messages/events/","sub":"devices/nine-ios/messages/devicebound/#"},"d":[{"tg":"","id":"ios"}],"att":[{"p":"","dt":null,"agt":0,"tw":"","tg":"","d":[{"ln":"temperature","dt":0,"dv":"","tg":"","sq":1,"agt":0,"tw":""},{"ln":"humidity","dt":0,"dv":"10 to 15","tg":"","sq":2,"agt":0,"tw":""}]},{"p":"gyroscope","dt":2,"agt":0,"tw":"","tg":"","d":[{"ln":"x","dt":0,"dv":"","tg":"","sq":1,"agt":0,"tw":""},{"ln":"y","dt":1,"dv":"","tg":"","sq":2,"agt":0,"tw":""},{"ln":"z","dt":0,"dv":"","tg":"","sq":3,"agt":0,"tw":""}]}],"set":[{"ln":"firmware_version","dt":0,"dv":""}],"r":null,"ota":null,"dtg":"89a2e49b-7546-45ad-a574-cde745c2f8c3","cpId":"nine","rc":0,"ee":0,"at":1,"ds":0}}

struct IoTData: Codable {
let d: D

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ extension MqttClientService: CocoaMQTTDelegate {
subscribeCocoaMqtt(topic: SDKConstants.TwinResponseSubTopic, completion:{_ in })

// Check for offline storage

}
}

Expand All @@ -152,7 +151,7 @@ extension MqttClientService: CocoaMQTTDelegate {
// Receive messages
func mqtt(_ mqtt: CocoaMQTT, didReceiveMessage message: CocoaMQTTMessage, id: UInt16) {
if let data = message.string?.data(using: .utf8) {
guard let messageData = try? JSONSerialization.jsonObject(with: data, options: .mutableContainers) else {
guard (try? JSONSerialization.jsonObject(with: data, options: .mutableContainers)) != nil else {
printLogs(msg: "Invalid json formate")
return
}
Expand Down
Loading

0 comments on commit c4406f8

Please sign in to comment.