Skip to content

Instantly share code, notes, and snippets.

View anditto's full-sized avatar
🤖

Anditto Heristyo anditto

🤖
View GitHub Profile
- (void)pushBeaconInfo
{
for (int i = 0; i < self.beaconsArray.count; i++) {
NSString *beaconMajorString = [((ESTBeacon *) self.beaconsArray[i]).major stringValue];
NSString *beaconMinorString = [((ESTBeacon *) self.beaconsArray[i]).minor stringValue];
NSNumber *beacondist = ((ESTBeacon *) self.beaconsArray[i]).distance;
// Beacon Major
((UILabel *) self.majorArray[i]).text = beaconMajorString;
- (void)beaconManager:(ESTBeaconManager *)manager didRangeBeacons:(NSArray *)beacons inRegion:(ESTBeaconRegion *)region
{
self.beaconsArray = beacons;
[self pushBeaconInfo];
}
- (void)beaconManager:(ESTBeaconManager *)manager didDiscoverBeacons:(NSArray *)beacons inRegion:(ESTBeaconRegion *)region
{
self.beaconsArray = beacons;
[self pushBeaconInfo];
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
self.beaconManager = [[ESTBeaconManager alloc] init];
self.beaconManager.delegate = self;
self.region = [[ESTBeaconRegion alloc] initWithProximityUUID:ESTIMOTE_PROXIMITY_UUID identifier:@"EstimoteSampleRegion"];
@interface ETViewController : UIViewController
@property (nonatomic, copy) void (^completion)(ESTBeacon *);
@property (nonatomic, assign) ESTScanType scanType;
@property (nonatomic, strong) ESTBeaconManager *beaconManager;
@property (nonatomic, strong) ESTBeaconRegion *region;
@property (strong, nonatomic) NSArray *beaconsArray;
@property (strong, nonatomic) IBOutlet UILabel *messageLabel;
- (id)initWithScanType:(ESTScanType)scanType completion:(void (^)(ESTBeacon *))completion
{
self = [super init];
if (self) {
self.scanType = scanType;
self.completion = [completion copy];
}
return self;
}
#import "ETViewController.h"
@interface ETViewController () <ESTBeaconManagerDelegate>
@end
@implementation ETViewController
#import <UIKit/UIKit.h>
#import <ESTBeaconManager.h>
#import <ESTBeacon.h>
typedef enum : int
{
ESTScanTypeBlueTooth,
ESTScanTypeBeacon
} ESTScanType;
# Uncomment this line to define a global platform for your project
target "EstimoteTutorial" do
platform :ios, '7.0'
pod 'EstimoteSDK', '~> 1.3.0'
end
target "EstimoteTutorialTests" do
end
> pod init
> vim Podfile
import java.io.*;
import java.net.*;
public class MyEchoClient {
public static void main(String args[]) {
try {
Socket sock = new Socket("127.0.0.1" , 10007);
InputStream in = sock.getInputStream();
OutputStream out = sock.getOutputStream();
String str = "hello\n";