Commit b4acb77c authored by Hanruisong's avatar Hanruisong
Browse files

feat: 更新到 4.14.2

1.新增真机架构SDK。
parent 5aafef39
//
// InternetSpeedMeasuring.h
// HDBaseUtils
//
// Created by zwl on 2020/5/11.
// Copyright © 2020 zwl. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@class HDInternetSpeedMeasuring;
@protocol HDInternetSpeedMeasuringDelegate <NSObject>
@optional
/** 网络测速回调,当error存在时,bytes为-1
@param speedMeasuring 自身对象
@param bytes 字节数
@param error 错误信息
*/
-(void)HD_InternetSpeedMeasuring:(HDInternetSpeedMeasuring *)speedMeasuring Bytes:(long long)bytes Error:(NSError *)error;
@end
@interface HDInternetSpeedMeasuring : NSObject
/**
* @brief 测速间隔单位秒,调用start前设置有效。默认3秒
*/
@property(nonatomic,assign)CGFloat spaceTime;
/**
* @brief 代理
*/
@property(nonatomic,weak) id <HDInternetSpeedMeasuringDelegate> delegate;
/*!
* @method
* @abstract 开始测速
* @discussion 开始测速
*/
-(void)start;
/*!
* @method
* @abstract 停止测速
* @discussion 停止测速
*/
-(void)stop;
@end
//
// HDMarqueeAction.h
// HDMarqueeTool
//
// Created by zwl on 2020/3/10.
// Copyright © 2020 zwl. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@class HDMarqueeActionPosition;
///跑马灯动作
@interface HDMarqueeAction : NSObject
/**
* @brief 持续时间
*/
@property(nonatomic,assign)CGFloat duration;
/**
* @brief 动作开始时坐标位置
*/
@property(nonatomic,strong,readonly)HDMarqueeActionPosition * startPostion;
/**
* @brief 动作结束时坐标位置
*/
@property(nonatomic,strong,readonly)HDMarqueeActionPosition * endPostion;
@end
///用于记录每次的位置
@interface HDMarqueeActionPosition : NSObject
/**
* @brief 坐标位置,取值范围0 - 1,例如(0.5,0.5)
*/
@property(nonatomic,assign)CGPoint pos;
/**
* @brief 透明度,取值范围0 - 1
*/
@property(nonatomic,assign)CGFloat alpha;
@end
//
// HDMarqueeView.h
// HDMarqueeTool
//
// Created by zwl on 2020/3/9.
// Copyright © 2020 zwl. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <QuartzCore/QuartzCore.h>
@class HDMarqueeAction;
typedef NS_ENUM(NSUInteger, HDMarqueeViewStyle) {
HDMarqueeViewStyleTitle,//文字样式
HDMarqueeViewStyleImage //图片样式
};
///跑马灯控件
@interface HDMarqueeView : UIView
/**
* @brief 父视图,必填
*/
@property(nonatomic,assign)UIView * fatherView;
/**
* @brief 跑马灯样式,默认文字样式
*/
@property(nonatomic,assign)HDMarqueeViewStyle style;
/**
* @brief 跑马灯文字内容
*/
@property(nonatomic,copy)NSString * text;
/**
* @brief 跑马灯文字格式
*/
@property(nonatomic,copy)NSDictionary * textAttributed;
/**
* @brief 跑马灯文字对齐方式,默认kCAAlignmentNatural
*/
@property(nonatomic,copy)NSString * textAlignmentMode;
/**
* @brief 跑马灯文字显示不全时,裁剪方式,默认kCATruncationNone
*/
@property(nonatomic,copy)NSString * textTruncationMode;
/**
* @brief 跑马灯文字是否自动换行,默认NO
*/
@property(nonatomic,assign)BOOL wrapped;
/**
* @brief 跑马灯图片
*/
@property(nonatomic,strong)NSURL * imageURL;
/**
* @brief 跑马灯效果,必填
*/
@property(nonatomic,strong)NSArray <HDMarqueeAction *> * actions;
/**
* @brief 循环次数,默认1,0表示无限循环
*/
@property(nonatomic,assign)NSInteger repeatCount;
/*!
* @method
* @abstract 开始跑马灯
* @discussion 开始跑马灯
*/
-(void)startMarquee;
/*!
* @method
* @abstract 结束跑马灯
* @discussion 结束跑马灯
*/
-(void)stopMarquee;
@end
/*
Copyright (C) 2016 Apple Inc. All Rights Reserved.
See LICENSE.txt for this sample’s licensing information
Abstract:
Basic demonstration of how to use the SystemConfiguration Reachablity APIs.
*/
#import <Foundation/Foundation.h>
#import <SystemConfiguration/SystemConfiguration.h>
#import <netinet/in.h>
typedef enum : NSInteger {
HDNotReachable = 0,
HDReachableViaWiFi,
HDReachableViaWWAN
} HDNetworkStatus;
#pragma mark IPv6 Support
//Reachability fully support IPv6. For full details, see ReadMe.md.
extern NSString *kHDReachabilityChangedNotification;
@interface HDReachability : NSObject
/*!
* Use to check the reachability of a given host name.
*/
+ (instancetype)reachabilityWithHostName:(NSString *)hostName;
/*!
* Use to check the reachability of a given IP address.
*/
+ (instancetype)reachabilityWithAddress:(const struct sockaddr *)hostAddress;
/*!
* Checks whether the default route is available. Should be used by applications that do not connect to a particular host.
*/
+ (instancetype)reachabilityForInternetConnection;
#pragma mark reachabilityForLocalWiFi
//reachabilityForLocalWiFi has been removed from the sample. See ReadMe.md for more information.
//+ (instancetype)reachabilityForLocalWiFi;
/*!
* Start listening for reachability notifications on the current run loop.
*/
- (BOOL)startNotifier;
- (void)stopNotifier;
- (HDNetworkStatus)currentReachabilityStatus;
/*!
* WWAN may be available, but not active until a connection has been established. WiFi may require a connection for VPN on Demand.
*/
- (BOOL)connectionRequired;
@end
//
// HDSReportClient.h
// CCFuncTool
//
// Created by Chenfy on 2020/2/7.
// Copyright © 2020 com.class.chenfy. All rights reserved.
//
#import <Foundation/Foundation.h>
//日志类别
typedef NS_ENUM(int, CCErrorLevel) {
CCErrorLevel_VERBOSE = 2,
CCErrorLevel_DEBUG = 3,
CCErrorLevel_INFO = 4,
CCErrorLevel_WARN = 5,
CCErrorLevel_ERROR = 6,
CCErrorLevel_ASSERT = 7,
};
NS_ASSUME_NONNULL_BEGIN
#pragma mark -- 云课堂使用
@interface HDSReportInfo : NSObject
@property(nonatomic,assign)NSTimeInterval responseTime;
@property(nonatomic,assign)CCErrorLevel level;
@property(nonatomic,copy)NSString *socketUrl;
//基本数据
@property(nonatomic,copy)NSString *var_business;
@property(nonatomic,copy)NSString *var_appVer;
@property(nonatomic,copy)NSString *var_cdn;
@property(nonatomic,copy)NSString *var_appid;
@property(nonatomic,copy)NSDictionary *var_device;
@property(nonatomic,assign)int var_serviceplatform;
@property(nonatomic,copy)NSString *var_roomid;
@property(nonatomic,copy)NSString *var_role;
@property(nonatomic,copy)NSString *var_userid;
@property(nonatomic,copy)NSString *var_username;
//事件数据
@property(nonatomic,copy)NSString *event_event;
@property(nonatomic,assign)int event_code;
@property(nonatomic,copy)NSString *event_msg;
//data
@property(nonatomic,strong)NSDictionary *event_data_requestmsg;
@property(nonatomic,strong)NSDictionary *event_data_responsemsg;
@property(nonatomic,strong)NSDictionary *event_data_stream;
@property(nonatomic,strong)NSDictionary *event_data_pusher;
@property(nonatomic,strong)NSDictionary *event_data_heartBeat;
@end
@interface HDSReportClient : NSObject
#pragma mark -- 新版API
/**
* @param business 业务类型
* @param sdkVer sdk版本号
*/
- (void)envInit:(NSString *)business version:(NSString *)sdkVer;
/**
* 设置基础参数
* @param baseInfo 基础信息
*/
- (void)setBaseInfo:(NSDictionary *)baseInfo;
/**
* 日志上报
* @param extraInfo 业务信息
*/
- (void)logReport:(NSDictionary *)extraInfo;
#pragma mark -- 旧版API
/** 云课堂旧版本使用 */
- (void)reportLogInfo:(HDSReportInfo *)info;
@end
NS_ASSUME_NONNULL_END
/*
Copyright (C) 2016 Apple Inc. All Rights Reserved.
See LICENSE.txt for this sample’s licensing information
Abstract:
An object wrapper around the low-level BSD Sockets ping function.
*/
@import Foundation;
#include <AssertMacros.h> // for __Check_Compile_Time
NS_ASSUME_NONNULL_BEGIN
@protocol HDSimplePingDelegate;
/*! Controls the IP address version used by SimplePing instances.
*/
typedef NS_ENUM(NSInteger, HDSimplePingAddressStyle) {
HDSimplePingAddressStyleAny, ///< Use the first IPv4 or IPv6 address found; the default.
HDSimplePingAddressStyleICMPv4, ///< Use the first IPv4 address found.
HDSimplePingAddressStyleICMPv6 ///< Use the first IPv6 address found.
};
/*! An object wrapper around the low-level BSD Sockets ping function.
* \details To use the class create an instance, set the delegate and call `-start`
* to start the instance on the current run loop. If things go well you'll soon get the
* `-simplePing:didStartWithAddress:` delegate callback. From there you can can call
* `-sendPingWithData:` to send a ping and you'll receive the
* `-simplePing:didReceivePingResponsePacket:sequenceNumber:` and
* `-simplePing:didReceiveUnexpectedPacket:` delegate callbacks as ICMP packets arrive.
*
* The class can be used from any thread but the use of any single instance must be
* confined to a specific thread and that thread must run its run loop.
*/
@interface HDSimplePing : NSObject
- (instancetype)init NS_UNAVAILABLE;
/*! Initialise the object to ping the specified host.
* \param hostName The DNS name of the host to ping; an IPv4 or IPv6 address in string form will
* work here.
* \returns The initialised object.
*/
- (instancetype)initWithHostName:(NSString *)hostName NS_DESIGNATED_INITIALIZER;
/*! A copy of the value passed to `-initWithHostName:`.
*/
@property (nonatomic, copy, readonly) NSString * hostName;
/*! The delegate for this object.
* \details Delegate callbacks are schedule in the default run loop mode of the run loop of the
* thread that calls `-start`.
*/
@property (nonatomic, weak, readwrite, nullable) id<HDSimplePingDelegate> delegate;
/*! Controls the IP address version used by the object.
* \details You should set this value before starting the object.
*/
@property (nonatomic, assign, readwrite) HDSimplePingAddressStyle addressStyle;
/*! The address being pinged.
* \details The contents of the NSData is a (struct sockaddr) of some form. The
* value is nil while the object is stopped and remains nil on start until
* `-simplePing:didStartWithAddress:` is called.
*/
@property (nonatomic, copy, readonly, nullable) NSData * hostAddress;
/*! The address family for `hostAddress`, or `AF_UNSPEC` if that's nil.
*/
@property (nonatomic, assign, readonly) sa_family_t hostAddressFamily;
/*! The identifier used by pings by this object.
* \details When you create an instance of this object it generates a random identifier
* that it uses to identify its own pings.
*/
@property (nonatomic, assign, readonly) uint16_t identifier;
/*! The next sequence number to be used by this object.
* \details This value starts at zero and increments each time you send a ping (safely
* wrapping back to zero if necessary). The sequence number is included in the ping,
* allowing you to match up requests and responses, and thus calculate ping times and
* so on.
*/
@property (nonatomic, assign, readonly) uint16_t nextSequenceNumber;
/*! Starts the object.
* \details You should set up the delegate and any ping parameters before calling this.
*
* If things go well you'll soon get the `-simplePing:didStartWithAddress:` delegate
* callback, at which point you can start sending pings (via `-sendPingWithData:`) and
* will start receiving ICMP packets (either ping responses, via the
* `-simplePing:didReceivePingResponsePacket:sequenceNumber:` delegate callback, or
* unsolicited ICMP packets, via the `-simplePing:didReceiveUnexpectedPacket:` delegate
* callback).
*
* If the object fails to start, typically because `hostName` doesn't resolve, you'll get
* the `-simplePing:didFailWithError:` delegate callback.
*
* It is not correct to start an already started object.
*/
- (void)start;
/*! Sends a ping packet containing the specified data.
* \details Sends an actual ping.
*
* The object must be started when you call this method and, on starting the object, you must
* wait for the `-simplePing:didStartWithAddress:` delegate callback before calling it.
* \param data Some data to include in the ping packet, after the ICMP header, or nil if you
* want the packet to include a standard 56 byte payload (resulting in a standard 64 byte
* ping).
*/
- (void)sendPingWithData:(nullable NSData *)data;
/*! Stops the object.
* \details You should call this when you're done pinging.
*
* It's safe to call this on an object that's stopped.
*/
- (void)stop;
@end
/*! A delegate protocol for the SimplePing class.
*/
@protocol HDSimplePingDelegate <NSObject>
@optional
/*! A SimplePing delegate callback, called once the object has started up.
* \details This is called shortly after you start the object to tell you that the
* object has successfully started. On receiving this callback, you can call
* `-sendPingWithData:` to send pings.
*
* If the object didn't start, `-simplePing:didFailWithError:` is called instead.
* \param pinger The object issuing the callback.
* \param address The address that's being pinged; at the time this delegate callback
* is made, this will have the same value as the `hostAddress` property.
*/
- (void)simplePing:(HDSimplePing *)pinger didStartWithAddress:(NSData *)address;
/*! A SimplePing delegate callback, called if the object fails to start up.
* \details This is called shortly after you start the object to tell you that the
* object has failed to start. The most likely cause of failure is a problem
* resolving `hostName`.
*
* By the time this callback is called, the object has stopped (that is, you don't
* need to call `-stop` yourself).
* \param pinger The object issuing the callback.
* \param error Describes the failure.
*/
- (void)simplePing:(HDSimplePing *)pinger didFailWithError:(NSError *)error;
/*! A SimplePing delegate callback, called when the object has successfully sent a ping packet.
* \details Each call to `-sendPingWithData:` will result in either a
* `-simplePing:didSendPacket:sequenceNumber:` delegate callback or a
* `-simplePing:didFailToSendPacket:sequenceNumber:error:` delegate callback (unless you
* stop the object before you get the callback). These callbacks are currently delivered
* synchronously from within `-sendPingWithData:`, but this synchronous behaviour is not
* considered API.
* \param pinger The object issuing the callback.
* \param packet The packet that was sent; this includes the ICMP header (`ICMPHeader`) and the
* data you passed to `-sendPingWithData:` but does not include any IP-level headers.
* \param sequenceNumber The ICMP sequence number of that packet.
*/
- (void)simplePing:(HDSimplePing *)pinger didSendPacket:(NSData *)packet sequenceNumber:(uint16_t)sequenceNumber;
/*! A SimplePing delegate callback, called when the object fails to send a ping packet.
* \details Each call to `-sendPingWithData:` will result in either a
* `-simplePing:didSendPacket:sequenceNumber:` delegate callback or a
* `-simplePing:didFailToSendPacket:sequenceNumber:error:` delegate callback (unless you
* stop the object before you get the callback). These callbacks are currently delivered
* synchronously from within `-sendPingWithData:`, but this synchronous behaviour is not
* considered API.
* \param pinger The object issuing the callback.
* \param packet The packet that was not sent; see `-simplePing:didSendPacket:sequenceNumber:`
* for details.
* \param sequenceNumber The ICMP sequence number of that packet.
* \param error Describes the failure.
*/
- (void)simplePing:(HDSimplePing *)pinger didFailToSendPacket:(NSData *)packet sequenceNumber:(uint16_t)sequenceNumber error:(NSError *)error;
/*! A SimplePing delegate callback, called when the object receives a ping response.
* \details If the object receives an ping response that matches a ping request that it
* sent, it informs the delegate via this callback. Matching is primarily done based on
* the ICMP identifier, although other criteria are used as well.
* \param pinger The object issuing the callback.
* \param packet The packet received; this includes the ICMP header (`ICMPHeader`) and any data that
* follows that in the ICMP message but does not include any IP-level headers.
* \param sequenceNumber The ICMP sequence number of that packet.
*/
- (void)simplePing:(HDSimplePing *)pinger didReceivePingResponsePacket:(NSData *)packet sequenceNumber:(uint16_t)sequenceNumber;
/*! A SimplePing delegate callback, called when the object receives an unmatched ICMP message.
* \details If the object receives an ICMP message that does not match a ping request that it
* sent, it informs the delegate via this callback. The nature of ICMP handling in a
* BSD kernel makes this a common event because, when an ICMP message arrives, it is
* delivered to all ICMP sockets.
*
* IMPORTANT: This callback is especially common when using IPv6 because IPv6 uses ICMP
* for important network management functions. For example, IPv6 routers periodically
* send out Router Advertisement (RA) packets via Neighbor Discovery Protocol (NDP), which
* is implemented on top of ICMP.
*
* For more on matching, see the discussion associated with
* `-simplePing:didReceivePingResponsePacket:sequenceNumber:`.
* \param pinger The object issuing the callback.
* \param packet The packet received; this includes the ICMP header (`ICMPHeader`) and any data that
* follows that in the ICMP message but does not include any IP-level headers.
*/
- (void)simplePing:(HDSimplePing *)pinger didReceiveUnexpectedPacket:(NSData *)packet;
@end
#pragma mark * ICMP On-The-Wire Format
/*! Describes the on-the-wire header format for an ICMP ping.
* \details This defines the header structure of ping packets on the wire. Both IPv4 and
* IPv6 use the same basic structure.
*
* This is declared in the header because clients of SimplePing might want to use
* it parse received ping packets.
*/
struct HDICMPHeader {
uint8_t type;
uint8_t code;
uint16_t checksum;
uint16_t identifier;
uint16_t sequenceNumber;
// data...
};
typedef struct HDICMPHeader HDICMPHeader;
__Check_Compile_Time(sizeof(HDICMPHeader) == 8);
__Check_Compile_Time(offsetof(HDICMPHeader, type) == 0);
__Check_Compile_Time(offsetof(HDICMPHeader, code) == 1);
__Check_Compile_Time(offsetof(HDICMPHeader, checksum) == 2);
__Check_Compile_Time(offsetof(HDICMPHeader, identifier) == 4);
__Check_Compile_Time(offsetof<