Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复不能自动连接的bug #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0730"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B9499D371CDB1FFF00542039"
BuildableName = "SEBLEPrinter.app"
BlueprintName = "SEBLEPrinter"
ReferencedContainer = "container:SEBLEPrinter.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B9499D371CDB1FFF00542039"
BuildableName = "SEBLEPrinter.app"
BlueprintName = "SEBLEPrinter"
ReferencedContainer = "container:SEBLEPrinter.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B9499D371CDB1FFF00542039"
BuildableName = "SEBLEPrinter.app"
BlueprintName = "SEBLEPrinter"
ReferencedContainer = "container:SEBLEPrinter.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B9499D371CDB1FFF00542039"
BuildableName = "SEBLEPrinter.app"
BlueprintName = "SEBLEPrinter"
ReferencedContainer = "container:SEBLEPrinter.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>SEBLEPrinter.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>B9499D371CDB1FFF00542039</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>
33 changes: 24 additions & 9 deletions SEBLEPrinter/BLEPrinter/SEPrinterManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,15 @@ @implementation SEPrinterManager

+ (instancetype)sharedInstance
{
return [[self alloc] init];
// return [[self alloc] init];
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
instance = [[SEPrinterManager alloc] init];

[instance resetBLEModel];
});

return instance;
}

+ (NSString *)UUIDStringForLastPeripheral
Expand All @@ -54,14 +62,21 @@ + (NSString *)UUIDStringForLastPeripheral

- (instancetype)init
{
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
instance = [super init];
instance.perpherals = [[NSMutableArray alloc] init];
instance.writeChatacters = [[NSMutableArray alloc] init];
instance.timeout = 30;
});
return instance;
// static dispatch_once_t onceToken;
// dispatch_once(&onceToken, ^{
// instance = [super init];
// instance.perpherals = [[NSMutableArray alloc] init];
// instance.writeChatacters = [[NSMutableArray alloc] init];
// instance.timeout = 30;
// });
// return instance;
self = [super init];
if (self) {
_perpherals = [[NSMutableArray alloc] init];
_writeChatacters = [[NSMutableArray alloc] init];
_timeout = 30;
}
return self;
}

+ (instancetype)allocWithZone:(struct _NSZone *)zone
Expand Down