Skip to content

Instantly share code, notes, and snippets.

@moonmile
moonmile / COCOAの接触通知シーケンス図
Last active September 15, 2020 01:54
COCOAシーケンス図
> Written with [StackEdit](https://stackedit.io/).
# 接触数コード解析
## 「陽性者との接触を確認する」をクリックした時
ホーム画面から「陽性者との接触を確認する」をクリックしたときは、
1. UserDataModel::ExposureInformation コレクションの数を調べる
@moonmile
moonmile / COCOAシーケンス図.md
Last active September 16, 2020 14:58
COCOAシーケンス図

Written with StackEdit.

接触数コード解析

「陽性者との接触を確認する」をクリックした時

ホーム画面から「陽性者との接触を確認する」をクリックしたときは、

  1. UserDataModel::ExposureInformation コレクションの数を調べる
@moonmile
moonmile / gist:bff5a25af533f937af702b173530bde0
Created September 14, 2020 16:06
UserDataModel::ExposureInformation コレクションへの追加(iOS版)
```mermaid
sequenceDiagram
PlatformScheduleFetch ->> ExposureNotification(share): UpdateKeysFromServer
ExposureNotification(share) ->> ExposureNotificationHandler: FetchExposureKeyBatchFilesFromServerAsync(submitBatches)
ExposureNotificationHandler ->> ExposureNotificationHandler: DownloadBatchAsync
ExposureNotificationHandler -->> ExposureNotificationHandler: downloadedFiles
ExposureNotificationHandler ->> ExposureNotificationHandler: downloadedFiles.Count > 0
ExposureNotificationHandler ->> ExposureNotification(share): submitBatches: callback
```mermaid
sequenceDiagram
HomePageView ->> HomePageViewModel: OnClickExposures
HomePageViewModel ->> ExposureNotificationService: GetExposureCount()
ExposureNotificationService ->> UserDataModel: ExposureInformation.Count()
Note right of UserDataModel: UserDataModel::ExposureInformationに保持される
UserDataModel -->> ExposureNotificationService: count
ExposureNotificationService -->> HomePageViewModel: count
@moonmile
moonmile / ContactTracingAppFinder.ino
Last active August 17, 2020 03:04 — forked from ksasao/ContactTracingAppFinder.ino
接触確認アプリが有効になっているかを調べるアプリの M5Stack 版です。取得した ServiceData(RPI)を表示させています。https://twitter.com/ksasao/status/1274385507565178885 参照。Apache 2.0ライセンスです。
#include <M5Stack.h>
#include <BLEDevice.h>
// Contact Tracing Bluetooth Specification (Apple/Google)
// https://blog.google/documents/58/Contact_Tracing_-_Bluetooth_Specification_v1.1_RYGZbKW.pdf
const char* uuid = "0000fd6f-0000-1000-8000-00805f9b34fb";
unsigned int count = 0;
class MyAdvertisedDeviceCallbacks: public BLEAdvertisedDeviceCallbacks {
void onResult(BLEAdvertisedDevice advertisedDevice) {
// SoftwareSerial を使って Bluetooth で通信
#include <SoftwareSerial.h>
#include <TinyWireM.h>
const int DRV8830 = 0xC8 >> 1 ; // 0x64;
SoftwareSerial mySerial = SoftwareSerial(3, 4); // RX, TX
void writeRegister( int drv, byte vset, byte data )
{
@moonmile
moonmile / gist:16c950174d0c276cc2c3
Last active December 18, 2015 11:32
SignedRequestHelper.cs for WinRT
/**********************************************************************************************
* Copyright 2009 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file
* except in compliance with the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "LICENSE.txt" file accompanying this file. This file is distributed on an "AS IS"
* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@moonmile
moonmile / gist:91573c79fed65062a217
Created August 10, 2014 01:37
make .NET Profile to Excel sheet
open System
open System.IO
open System.Linq
// make dir.txt
// C:\Users\masuda>dir /s/b "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable\" > dir.txt
let mutable profiles = []
let mutable targets = []
let mutable pnames = []
@moonmile
moonmile / gist:7c44e5130617c7a76a87
Created July 3, 2014 06:38
C# で joystick を利用する
using System;
using System.IO;
using System.Threading.Tasks;
// gmcs -sdk:4.5 /o:joytest.exe joytest.cs
namespace Sample.bot
{
public struct js_event
{